You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2015/10/30 12:34:40 UTC
[01/50] [abbrv] syncope git commit: ConnId AD 1.2.4
Repository: syncope
Updated Branches:
refs/heads/SYNCOPE-156 ee7ca3431 -> e9bf6d17f
ConnId AD 1.2.4
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4dd34556
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4dd34556
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4dd34556
Branch: refs/heads/SYNCOPE-156
Commit: 4dd345565388678ac3fd091aa1c49aa53cab20d6
Parents: 56f1598
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 19 18:08:29 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 19 18:08:29 2015 +0200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4dd34556/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4ef0802..7c0e39a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -333,7 +333,7 @@ under the License.
<connid.db.table.version>2.2.2</connid.db.table.version>
<connid.csvdir.version>0.8.2</connid.csvdir.version>
<connid.ldap.version>1.4.0</connid.ldap.version>
- <connid.ad.version>1.2.3</connid.ad.version>
+ <connid.ad.version>1.2.4</connid.ad.version>
<commons-jexl.version>2.1.1</commons-jexl.version>
<commons-lang.version>3.3.2</commons-lang.version>
[23/50] [abbrv] syncope git commit: [SYNCOPE-141] Preliminary changes
Posted by fm...@apache.org.
[SYNCOPE-141] Preliminary changes
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0211410b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0211410b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0211410b
Branch: refs/heads/SYNCOPE-156
Commit: 0211410bac90d6d7b48bbeaa20675dadfe70b255
Parents: 1ebc0bc
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 26 14:43:22 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Oct 29 10:21:20 2015 +0100
----------------------------------------------------------------------
.../syncope/core/logic/AbstractAnyLogic.java | 4 +-
.../apache/syncope/core/logic/GroupLogic.java | 2 +-
.../syncope/core/logic/ResourceLogic.java | 4 +-
.../notification/NotificationJobDelegate.java | 2 +-
.../core/logic/report/ReportJobDelegate.java | 2 +-
.../core/logic/report/StaticReportlet.java | 2 +-
.../core/logic/report/UserReportlet.java | 2 +-
.../syncope/core/misc/ConnObjectUtils.java | 259 ------
.../syncope/core/misc/ExceptionUtils2.java | 47 --
.../apache/syncope/core/misc/FormatUtils.java | 117 ---
.../apache/syncope/core/misc/MappingUtils.java | 831 -------------------
.../apache/syncope/core/misc/RealmUtils.java | 61 --
.../apache/syncope/core/misc/TemplateUtils.java | 223 -----
.../syncope/core/misc/jexl/JexlUtils.java | 2 +-
.../core/misc/security/AuthDataAccessor.java | 4 +-
.../misc/security/SyncopeGrantedAuthority.java | 2 +-
.../core/misc/utils/ConnObjectUtils.java | 259 ++++++
.../core/misc/utils/ExceptionUtils2.java | 47 ++
.../syncope/core/misc/utils/FormatUtils.java | 117 +++
.../syncope/core/misc/utils/MappingUtils.java | 831 +++++++++++++++++++
.../syncope/core/misc/utils/RealmUtils.java | 61 ++
.../syncope/core/misc/utils/TemplateUtils.java | 223 +++++
core/misc/src/main/resources/utilsContext.xml | 32 +
.../jpa/content/ContentLoaderHandler.java | 2 +-
.../jpa/content/XMLContentExporter.java | 2 +-
.../persistence/jpa/dao/JPAAnySearchDAO.java | 2 +-
.../core/persistence/jpa/dao/JPAGroupDAO.java | 2 +-
.../jpa/entity/AbstractPlainAttrValue.java | 2 +-
.../provisioning/java/ConnectorFacadeProxy.java | 2 +-
.../provisioning/java/VirAttrHandlerImpl.java | 2 +-
.../java/data/AbstractAnyDataBinder.java | 4 +-
.../java/data/RealmDataBinderImpl.java | 2 +-
.../java/data/TaskDataBinderImpl.java | 2 +-
.../java/job/AbstractSchedTaskJobDelegate.java | 2 +-
.../core/provisioning/java/job/TaskJob.java | 2 +-
.../AbstractPropagationTaskExecutor.java | 6 +-
.../propagation/DefaultPropagationReporter.java | 2 +-
.../PriorityPropagationTaskExecutor.java | 13 +-
.../propagation/PropagationManagerImpl.java | 4 +-
.../java/sync/AbstractPushResultHandler.java | 2 +-
.../java/sync/AbstractSyncopeResultHandler.java | 2 +-
.../sync/PlainAttrsSyncCorrelationRule.java | 4 +-
.../provisioning/java/sync/SyncJobDelegate.java | 2 +-
.../core/provisioning/java/sync/SyncUtils.java | 2 +-
.../src/main/resources/provisioning.properties | 3 +
.../src/main/resources/provisioningContext.xml | 12 +-
.../core/provisioning/java/AbstractTest.java | 1 +
.../core/provisioning/java/MappingTest.java | 2 +-
.../rest/cxf/ThreadLocalCleanupListener.java | 2 +-
.../src/main/resources/provisioning.properties | 4 +
fit/core-reference/pom.xml | 1 +
.../main/resources/all/provisioning.properties | 4 +
.../resources/mariadb/provisioning.properties | 5 +-
.../resources/mysql/provisioning.properties | 5 +-
.../resources/oracle/provisioning.properties | 5 +-
.../resources/postgres/provisioning.properties | 5 +-
.../src/main/resources/provisioning.properties | 5 +-
.../resources/sqlserver/provisioning.properties | 5 +-
58 files changed, 1660 insertions(+), 1596 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
index 9a796ef..111f0ba 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
@@ -34,8 +34,8 @@ import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.core.misc.RealmUtils;
-import org.apache.syncope.core.misc.TemplateUtils;
+import org.apache.syncope.core.misc.utils.RealmUtils;
+import org.apache.syncope.core.misc.utils.TemplateUtils;
import org.apache.syncope.core.misc.security.DelegatedAdministrationException;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index 2a2e0a3..a563088 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -42,7 +42,7 @@ import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.PatchOperation;
-import org.apache.syncope.core.misc.RealmUtils;
+import org.apache.syncope.core.misc.utils.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/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 a6a2610..c392058 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
@@ -49,8 +49,8 @@ import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.ConnectorFactory;
import org.apache.syncope.core.provisioning.api.data.ResourceDataBinder;
-import org.apache.syncope.core.misc.ConnObjectUtils;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.ConnObjectUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJobDelegate.java b/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJobDelegate.java
index 763bab5..df8c629 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJobDelegate.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/notification/NotificationJobDelegate.java
@@ -26,7 +26,7 @@ import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.ExceptionUtils2;
+import org.apache.syncope.core.misc.utils.ExceptionUtils2;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJobDelegate.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJobDelegate.java
index 2b63d1b..9d764ba 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJobDelegate.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/ReportJobDelegate.java
@@ -33,7 +33,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.report.ReportletConf;
import org.apache.syncope.common.lib.types.ReportExecStatus;
-import org.apache.syncope.core.misc.ExceptionUtils2;
+import org.apache.syncope.core.misc.utils.ExceptionUtils2;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.ImplementationLookup;
import org.apache.syncope.core.persistence.api.dao.ReportDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/logic/src/main/java/org/apache/syncope/core/logic/report/StaticReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/StaticReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/StaticReportlet.java
index 0e785b1..37e896b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/StaticReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/StaticReportlet.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.logic.report;
import org.apache.syncope.core.persistence.api.dao.ReportletConfClass;
import org.apache.syncope.common.lib.report.ReportletConf;
import org.apache.syncope.common.lib.report.StaticReportletConf;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.springframework.util.StringUtils;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
index 3eb96b3..2523e8f 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/UserReportlet.java
@@ -38,7 +38,7 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.misc.search.SearchCondConverter;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.persistence.api.entity.user.URelationship;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
deleted file mode 100644
index f78cc31..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtils.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.misc;
-
-import org.apache.syncope.core.misc.policy.InvalidPasswordRuleConf;
-import org.apache.syncope.core.misc.security.SecureRandomUtils;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.AnyOperations;
-import org.apache.syncope.common.lib.patch.AnyPatch;
-import org.apache.syncope.common.lib.policy.PasswordRuleConf;
-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.ConnObjectTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.AnyUtils;
-import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.misc.security.Encryptor;
-import org.apache.syncope.core.misc.security.PasswordGenerator;
-import org.apache.syncope.core.persistence.api.dao.RealmDAO;
-import org.apache.syncope.core.persistence.api.entity.Realm;
-import org.apache.syncope.core.persistence.api.entity.resource.Provision;
-import org.identityconnectors.common.Base64;
-import org.identityconnectors.common.security.GuardedByteArray;
-import org.identityconnectors.common.security.GuardedString;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-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;
-
-@Component
-public class ConnObjectUtils {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnObjectUtils.class);
-
- private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
-
- @Autowired
- private TemplateUtils templateUtils;
-
- @Autowired
- private RealmDAO realmDAO;
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private ExternalResourceDAO resourceDAO;
-
- @Autowired
- private PasswordGenerator passwordGenerator;
-
- @Autowired
- private MappingUtils mappingUtils;
-
- /**
- * Extract password value from passed value (if instance of GuardedString or GuardedByteArray).
- *
- * @param pwd received from the underlying connector
- * @return password value
- */
- public static String getPassword(final Object pwd) {
- final StringBuilder result = new StringBuilder();
-
- if (pwd instanceof GuardedString) {
- ((GuardedString) pwd).access(new GuardedString.Accessor() {
-
- @Override
- public void access(final char[] clearChars) {
- result.append(clearChars);
- }
- });
- } else if (pwd instanceof GuardedByteArray) {
- ((GuardedByteArray) pwd).access(new GuardedByteArray.Accessor() {
-
- @Override
- public void access(final byte[] clearBytes) {
- result.append(new String(clearBytes));
- }
- });
- } else if (pwd instanceof String) {
- result.append((String) pwd);
- } else {
- result.append(pwd.toString());
- }
-
- return result.toString();
- }
-
- /**
- * Build a UserTO / GroupTO / AnyObjectTO out of connector object attributes and schema mapping.
- *
- * @param obj connector object
- * @param syncTask synchronization task
- * @param provision provision information
- * @param anyUtils utils
- * @param <T> any object
- * @return UserTO for the user to be created
- */
- @Transactional(readOnly = true)
- public <T extends AnyTO> T getAnyTO(
- final ConnectorObject obj, final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
-
- T anyTO = getAnyTOFromConnObject(obj, syncTask, provision, anyUtils);
-
- // (for users) if password was not set above, generate
- if (anyTO instanceof UserTO && StringUtils.isBlank(((UserTO) anyTO).getPassword())) {
- final UserTO userTO = (UserTO) anyTO;
-
- List<PasswordRuleConf> ruleConfs = new ArrayList<>();
-
- Realm realm = realmDAO.find(userTO.getRealm());
- if (realm != null) {
- for (Realm ancestor : realmDAO.findAncestors(realm)) {
- if (ancestor.getPasswordPolicy() != null) {
- ruleConfs.addAll(ancestor.getPasswordPolicy().getRuleConfs());
- }
- }
- }
-
- for (String resName : userTO.getResources()) {
- ExternalResource resource = resourceDAO.find(resName);
- if (resource != null && resource.getPasswordPolicy() != null) {
- ruleConfs.addAll(resource.getPasswordPolicy().getRuleConfs());
- }
- }
-
- String password;
- try {
- password = passwordGenerator.generate(ruleConfs);
- } catch (InvalidPasswordRuleConf e) {
- LOG.error("Could not generate policy-compliant random password for {}", userTO, e);
-
- password = SecureRandomUtils.generateRandomPassword(16);
- }
- userTO.setPassword(password);
- }
-
- return anyTO;
- }
-
- /**
- * Build {@link AnyPatch} out of connector object attributes and schema mapping.
- *
- * @param key any object to be updated
- * @param obj connector object
- * @param original any object to get diff from
- * @param syncTask synchronization task
- * @param provision provision information
- * @param anyUtils utils
- * @param <T> any object
- * @return modifications for the any object to be updated
- */
- @SuppressWarnings("unchecked")
- @Transactional(readOnly = true)
- public <T extends AnyPatch> T getAnyPatch(final Long key, final ConnectorObject obj,
- final AnyTO original, final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
-
- AnyTO updated = getAnyTOFromConnObject(obj, syncTask, provision, anyUtils);
- updated.setKey(key);
-
- if (AnyTypeKind.USER == anyUtils.getAnyTypeKind()) {
- // update password if and only if password is really changed
- User user = userDAO.authFind(key);
- if (StringUtils.isBlank(((UserTO) updated).getPassword())
- || ENCRYPTOR.verify(((UserTO) updated).getPassword(),
- user.getCipherAlgorithm(), user.getPassword())) {
-
- ((UserTO) updated).setPassword(null);
- }
- return (T) AnyOperations.diff(((UserTO) updated), ((UserTO) original), true);
- } else if (AnyTypeKind.GROUP == anyUtils.getAnyTypeKind()) {
- return (T) AnyOperations.diff(((GroupTO) updated), ((GroupTO) original), true);
- } else if (AnyTypeKind.ANY_OBJECT == anyUtils.getAnyTypeKind()) {
- return (T) AnyOperations.diff(((AnyObjectTO) updated), ((AnyObjectTO) original), true);
- }
-
- return null;
- }
-
- private <T extends AnyTO> T getAnyTOFromConnObject(final ConnectorObject obj,
- final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
-
- T anyTO = anyUtils.newAnyTO();
- anyTO.setType(provision.getAnyType().getKey());
-
- // 1. fill with data from connector object
- anyTO.setRealm(syncTask.getDestinatioRealm().getFullPath());
- for (MappingItem item : MappingUtils.getSyncMappingItems(provision)) {
- mappingUtils.setIntValues(item, obj.getAttributeByName(item.getExtAttrName()), anyTO, anyUtils);
- }
-
- // 2. add data from defined template (if any)
- templateUtils.apply(anyTO, syncTask.getTemplate(provision.getAnyType()));
-
- return anyTO;
- }
-
- /**
- * Get connector object TO from a connector object.
- *
- * @param connObject connector object.
- * @return connector object TO.
- */
- public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
- final ConnObjectTO connObjectTO = new ConnObjectTO();
-
- for (Attribute attr : connObject.getAttributes()) {
- AttrTO attrTO = new AttrTO();
- attrTO.setSchema(attr.getName());
-
- if (attr.getValue() != null) {
- for (Object value : attr.getValue()) {
- if (value != null) {
- if (value instanceof GuardedString || value instanceof GuardedByteArray) {
- attrTO.getValues().add(getPassword(value));
- } else if (value instanceof byte[]) {
- attrTO.getValues().add(Base64.encode((byte[]) value));
- } else {
- attrTO.getValues().add(value.toString());
- }
- }
- }
- }
-
- connObjectTO.getPlainAttrs().add(attrTO);
- }
-
- return connObjectTO;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java
deleted file mode 100644
index a4f04a6..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/ExceptionUtils2.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.misc;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
-public final class ExceptionUtils2 {
-
- /**
- * Uses commons lang's ExceptionUtils to provide a representation of the full stack trace of the given throwable.
- *
- * @param t throwable to build stack trace from
- * @return a string representation of full stack trace of the given throwable
- */
- public static String getFullStackTrace(final Throwable t) {
- StringBuilder result = new StringBuilder();
-
- for (Throwable throwable : ExceptionUtils.getThrowableList(t)) {
- result.append(ExceptionUtils.getMessage(throwable)).append('\n').
- append(ExceptionUtils.getStackTrace(throwable)).append("\n\n");
- }
-
- return result.toString();
- }
-
- /**
- * Private default constructor, for static-only classes.
- */
- private ExceptionUtils2() {
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/FormatUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/FormatUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/FormatUtils.java
deleted file mode 100644
index 0b06906..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/FormatUtils.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.misc;
-
-import java.text.DecimalFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import org.apache.commons.lang3.time.DateUtils;
-import org.apache.syncope.common.lib.SyncopeConstants;
-
-/**
- * Utility class for parsing / formatting date and numbers.
- */
-public final class FormatUtils {
-
- private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
-
- @Override
- protected SimpleDateFormat initialValue() {
- SimpleDateFormat sdf = new SimpleDateFormat();
- sdf.applyPattern(SyncopeConstants.DEFAULT_DATE_PATTERN);
- return sdf;
- }
- };
-
- private static final ThreadLocal<DecimalFormat> DECIMAL_FORMAT = new ThreadLocal<DecimalFormat>() {
-
- @Override
- protected DecimalFormat initialValue() {
- return new DecimalFormat();
- }
- };
-
- public static String format(final Date date) {
- return format(date, true);
- }
-
- public static String format(final Date date, final boolean lenient) {
- return format(date, lenient, null);
- }
-
- public static String format(final Date date, final boolean lenient, final String conversionPattern) {
- SimpleDateFormat sdf = DATE_FORMAT.get();
- if (conversionPattern != null) {
- sdf.applyPattern(conversionPattern);
- }
- sdf.setLenient(lenient);
- return sdf.format(date);
- }
-
- public static String format(final long number) {
- return format(number, null);
- }
-
- public static String format(final long number, final String conversionPattern) {
- DecimalFormat df = DECIMAL_FORMAT.get();
- if (conversionPattern != null) {
- df.applyPattern(conversionPattern);
- }
- return df.format(number);
- }
-
- public static String format(final double number) {
- return format(number, null);
- }
-
- public static String format(final double number, final String conversionPattern) {
- DecimalFormat df = DECIMAL_FORMAT.get();
- if (conversionPattern != null) {
- df.applyPattern(conversionPattern);
- }
- return df.format(number);
- }
-
- public static Date parseDate(final String source) throws ParseException {
- return DateUtils.parseDate(source, SyncopeConstants.DATE_PATTERNS);
- }
-
- public static Date parseDate(final String source, final String conversionPattern) throws ParseException {
- SimpleDateFormat sdf = DATE_FORMAT.get();
- sdf.applyPattern(conversionPattern);
- sdf.setLenient(false);
- return sdf.parse(source);
- }
-
- public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
- DecimalFormat df = DECIMAL_FORMAT.get();
- df.applyPattern(conversionPattern);
- return df.parse(source);
- }
-
- public static void clear() {
- DATE_FORMAT.remove();
- DECIMAL_FORMAT.remove();
- }
-
- private FormatUtils() {
- // private empty constructor
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
deleted file mode 100644
index aed2ee6..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.misc;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.collections4.ListUtils;
-import org.apache.commons.jexl2.JexlContext;
-import org.apache.commons.jexl2.MapContext;
-import org.apache.commons.lang3.ClassUtils;
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.Pair;
-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.UserTO;
-import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.core.misc.policy.InvalidPasswordRuleConf;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.AnyUtils;
-import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
-import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.PlainAttr;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
-import org.apache.syncope.core.misc.security.Encryptor;
-import org.apache.syncope.core.misc.jexl.JexlUtils;
-import org.apache.syncope.core.misc.security.PasswordGenerator;
-import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
-import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.Schema;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
-import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
-import org.apache.syncope.core.persistence.api.entity.resource.Provision;
-import org.apache.syncope.core.provisioning.api.VirAttrHandler;
-import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
-import org.identityconnectors.framework.common.FrameworkUtil;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.OperationOptions;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-public class MappingUtils {
-
- private static final Logger LOG = LoggerFactory.getLogger(MappingUtils.class);
-
- private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private AnyTypeDAO anyTypeDAO;
-
- @Autowired
- private PlainSchemaDAO plainSchemaDAO;
-
- @Autowired
- private VirSchemaDAO virSchemaDAO;
-
- @Autowired
- private VirAttrHandler virAttrHandler;
-
- @Autowired
- private VirAttrCache virAttrCache;
-
- @Autowired
- private PasswordGenerator passwordGenerator;
-
- @Autowired
- private EntityFactory entityFactory;
-
- @Autowired
- private AnyUtilsFactory anyUtilsFactory;
-
- public static MappingItem getConnObjectKeyItem(final Provision provision) {
- Mapping mapping = null;
- if (provision != null) {
- mapping = provision.getMapping();
- }
-
- return mapping == null
- ? null
- : mapping.getConnObjectKeyItem();
- }
-
- private static List<MappingItem> getMappingItems(final Provision provision, final MappingPurpose purpose) {
- List<? extends MappingItem> items = Collections.<MappingItem>emptyList();
- if (provision != null) {
- items = provision.getMapping().getItems();
- }
-
- List<MappingItem> result = new ArrayList<>();
-
- switch (purpose) {
- case SYNCHRONIZATION:
- for (MappingItem item : items) {
- if (MappingPurpose.PROPAGATION != item.getPurpose()
- && MappingPurpose.NONE != item.getPurpose()) {
-
- result.add(item);
- }
- }
- break;
-
- case PROPAGATION:
- for (MappingItem item : items) {
- if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
- && MappingPurpose.NONE != item.getPurpose()) {
-
- result.add(item);
- }
- }
- break;
-
- case BOTH:
- for (MappingItem item : items) {
- if (MappingPurpose.NONE != item.getPurpose()) {
- result.add(item);
- }
- }
- break;
-
- case NONE:
- for (MappingItem item : items) {
- if (MappingPurpose.NONE == item.getPurpose()) {
- result.add(item);
- }
- }
- break;
-
- default:
- }
-
- return result;
- }
-
- public static List<MappingItem> getBothMappingItems(final Provision provision) {
- return getMappingItems(provision, MappingPurpose.BOTH);
- }
-
- public static List<MappingItem> getPropagationMappingItems(final Provision provision) {
- return getMappingItems(provision, MappingPurpose.PROPAGATION);
- }
-
- public static List<MappingItem> getSyncMappingItems(final Provision provision) {
- return getMappingItems(provision, MappingPurpose.SYNCHRONIZATION);
- }
-
- /**
- * Build __NAME__ for propagation. First look if there ia a defined connObjectLink for the given resource (and in
- * this case evaluate as JEXL); otherwise, take given connObjectKey.
- *
- * @param any given any object
- * @param provision external resource
- * @param connObjectKey connector object key
- * @return the value to be propagated as __NAME__
- */
- public static Name evaluateNAME(final Any<?, ?> any, final Provision provision, final String connObjectKey) {
- if (StringUtils.isBlank(connObjectKey)) {
- // LOG error but avoid to throw exception: leave it to the external resource
- LOG.error("Missing ConnObjectKey for '{}': ", provision.getResource());
- }
-
- // Evaluate connObjectKey expression
- String connObjectLink = provision == null || provision.getMapping() == null
- ? null
- : provision.getMapping().getConnObjectLink();
- String evalConnObjectLink = null;
- if (StringUtils.isNotBlank(connObjectLink)) {
- JexlContext jexlContext = new MapContext();
- JexlUtils.addFieldsToContext(any, jexlContext);
- JexlUtils.addPlainAttrsToContext(any.getPlainAttrs(), jexlContext);
- JexlUtils.addDerAttrsToContext(any.getDerAttrs(), any.getPlainAttrs(), jexlContext);
- evalConnObjectLink = JexlUtils.evaluate(connObjectLink, jexlContext);
- }
-
- // If connObjectLink evaluates to an empty string, just use the provided connObjectKey as Name(),
- // otherwise evaluated connObjectLink expression is taken as Name().
- Name name;
- if (StringUtils.isBlank(evalConnObjectLink)) {
- // add connObjectKey as __NAME__ attribute ...
- LOG.debug("Add connObjectKey [{}] as __NAME__", connObjectKey);
- name = new Name(connObjectKey);
- } else {
- LOG.debug("Add connObjectLink [{}] as __NAME__", evalConnObjectLink);
- name = new Name(evalConnObjectLink);
-
- // connObjectKey not propagated: it will be used to set the value for __UID__ attribute
- LOG.debug("connObjectKey will be used just as __UID__ attribute");
- }
-
- return name;
- }
-
- public static List<MappingItemTransformer> getMappingItemTransformers(final MappingItem mappingItem) {
- List<MappingItemTransformer> result = new ArrayList<>();
-
- for (String className : mappingItem.getMappingItemTransformerClassNames()) {
- try {
- Class<?> transformerClass = ClassUtils.getClass(className);
-
- result.add((MappingItemTransformer) ApplicationContextProvider.
- getBeanFactory().
- createBean(transformerClass, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false));
- } catch (Exception e) {
- LOG.error("Could not instantiate {}, ignoring...", className, e);
- }
- }
-
- return result;
- }
-
- /**
- * Build options for requesting all mapped connector attributes.
- *
- * @param mapItems mapping items
- * @return options for requesting all mapped connector attributes
- * @see OperationOptions
- */
- public static OperationOptions buildOperationOptions(final Iterator<? extends MappingItem> mapItems) {
- OperationOptionsBuilder builder = new OperationOptionsBuilder();
-
- Set<String> attrsToGet = new HashSet<>();
- attrsToGet.add(Name.NAME);
- attrsToGet.add(Uid.NAME);
- attrsToGet.add(OperationalAttributes.ENABLE_NAME);
-
- while (mapItems.hasNext()) {
- MappingItem mapItem = mapItems.next();
- if (mapItem.getPurpose() != MappingPurpose.NONE) {
- attrsToGet.add(mapItem.getExtAttrName());
- }
- }
-
- builder.setAttributesToGet(attrsToGet);
- // -------------------------------------
-
- return builder.build();
- }
-
- /**
- * Prepare attributes for sending to a connector instance.
- *
- * @param any given any object
- * @param password clear-text password
- * @param changePwd whether password should be included for propagation attributes or not
- * @param enable whether any object must be enabled or not
- * @param provision provision information
- * @return connObjectLink + prepared attributes
- */
- @Transactional(readOnly = true)
- public Pair<String, Set<Attribute>> prepareAttrs(
- final Any<?, ?> any,
- final String password,
- final boolean changePwd,
- final Boolean enable,
- final Provision provision) {
-
- LOG.debug("Preparing resource attributes for {} with provision {} for attributes {}",
- any, provision, any.getPlainAttrs());
-
- Set<Attribute> attributes = new HashSet<>();
- String connObjectKey = null;
-
- for (MappingItem mappingItem : getMappingItems(provision, MappingPurpose.PROPAGATION)) {
- LOG.debug("Processing schema {}", mappingItem.getIntAttrName());
-
- try {
- Pair<String, Attribute> preparedAttr = prepareAttr(provision, mappingItem, any, password);
-
- if (preparedAttr != null && preparedAttr.getKey() != null) {
- connObjectKey = preparedAttr.getKey();
- }
-
- if (preparedAttr != null && preparedAttr.getValue() != null) {
- Attribute alreadyAdded = AttributeUtil.find(preparedAttr.getValue().getName(), attributes);
-
- if (alreadyAdded == null) {
- attributes.add(preparedAttr.getValue());
- } else {
- attributes.remove(alreadyAdded);
-
- Set<Object> values = new HashSet<>(alreadyAdded.getValue());
- values.addAll(preparedAttr.getValue().getValue());
-
- attributes.add(AttributeBuilder.build(preparedAttr.getValue().getName(), values));
- }
- }
- } catch (Exception e) {
- LOG.debug("Attribute '{}' processing failed", mappingItem.getIntAttrName(), e);
- }
- }
-
- Attribute connObjectKeyExtAttr =
- AttributeUtil.find(getConnObjectKeyItem(provision).getExtAttrName(), attributes);
- if (connObjectKeyExtAttr != null) {
- attributes.remove(connObjectKeyExtAttr);
- attributes.add(AttributeBuilder.build(getConnObjectKeyItem(provision).getExtAttrName(), connObjectKey));
- }
- attributes.add(evaluateNAME(any, provision, connObjectKey));
-
- if (enable != null) {
- attributes.add(AttributeBuilder.buildEnabled(enable));
- }
- if (!changePwd) {
- Attribute pwdAttr = AttributeUtil.find(OperationalAttributes.PASSWORD_NAME, attributes);
- if (pwdAttr != null) {
- attributes.remove(pwdAttr);
- }
- }
-
- return new ImmutablePair<>(connObjectKey, attributes);
- }
-
- /**
- * Prepare an attribute to be sent to a connector instance.
- *
- * @param provision external resource
- * @param mapItem mapping item for the given attribute
- * @param any any object
- * @param password clear-text password
- * @return connObjectLink + prepared attribute
- */
- private Pair<String, Attribute> prepareAttr(
- final Provision provision, final MappingItem mapItem, final Any<?, ?> any, final String password) {
-
- List<Any<?, ?>> anys = new ArrayList<>();
-
- switch (mapItem.getIntMappingType().getAnyTypeKind()) {
- case USER:
- if (any instanceof User) {
- anys.add(any);
- }
- break;
-
- case GROUP:
- if (any instanceof User) {
- for (Group group : userDAO.findAllGroups((User) any)) {
- anys.add(group);
- }
- } else if (any instanceof Group) {
- anys.add(any);
- }
- break;
-
- case ANY_OBJECT:
- if (any instanceof AnyObject) {
- anys.add(any);
- }
- break;
-
- default:
- }
-
- Schema schema = null;
- boolean readOnlyVirSchema = false;
- AttrSchemaType schemaType;
- Pair<String, Attribute> result;
-
- switch (mapItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- schema = plainSchemaDAO.find(mapItem.getIntAttrName());
- schemaType = schema == null ? AttrSchemaType.String : schema.getType();
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- schema = virSchemaDAO.find(mapItem.getIntAttrName());
- readOnlyVirSchema = (schema != null && schema.isReadonly());
- schemaType = AttrSchemaType.String;
- break;
-
- default:
- schemaType = AttrSchemaType.String;
- }
-
- String extAttrName = mapItem.getExtAttrName();
-
- List<PlainAttrValue> values = getIntValues(provision, mapItem, anys);
-
- LOG.debug("Define mapping for: "
- + "\n* ExtAttrName " + extAttrName
- + "\n* is connObjectKey " + mapItem.isConnObjectKey()
- + "\n* is password " + (mapItem.isPassword() || mapItem.getIntMappingType() == IntMappingType.Password)
- + "\n* mandatory condition " + mapItem.getMandatoryCondition()
- + "\n* Schema " + mapItem.getIntAttrName()
- + "\n* IntMappingType " + mapItem.getIntMappingType().toString()
- + "\n* ClassType " + schemaType.getType().getName()
- + "\n* Values " + values);
-
- if (readOnlyVirSchema) {
- result = null;
- } else {
- List<Object> objValues = new ArrayList<>();
-
- for (PlainAttrValue value : values) {
- if (FrameworkUtil.isSupportedAttributeType(schemaType.getType())) {
- objValues.add(value.getValue());
- } else {
- objValues.add(value.getValueAsString());
- }
- }
-
- if (mapItem.isConnObjectKey()) {
- result = new ImmutablePair<>(objValues.iterator().next().toString(), null);
- } else if (mapItem.isPassword() && any instanceof User) {
- String passwordAttrValue = password;
- if (StringUtils.isBlank(passwordAttrValue)) {
- User user = (User) any;
- if (user.canDecodePassword()) {
- try {
- passwordAttrValue = ENCRYPTOR.decode(user.getPassword(), user.getCipherAlgorithm());
- } catch (Exception e) {
- LOG.error("Could not decode password for {}", user, e);
- }
- } else if (provision.getResource().isRandomPwdIfNotProvided()) {
- try {
- passwordAttrValue = passwordGenerator.generate(user);
- } catch (InvalidPasswordRuleConf e) {
- LOG.error("Could not generate policy-compliant random password for {}", user, e);
- }
- }
- }
-
- if (passwordAttrValue == null) {
- result = null;
- } else {
- result = new ImmutablePair<>(
- null, AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
- }
- } else {
- if ((schema != null && schema.isMultivalue())
- || anyUtilsFactory.getInstance(any).getAnyTypeKind()
- != mapItem.getIntMappingType().getAnyTypeKind()) {
-
- result = new ImmutablePair<>(
- null, AttributeBuilder.build(extAttrName, objValues));
- } else {
- result = new ImmutablePair<>(
- null, objValues.isEmpty()
- ? AttributeBuilder.build(extAttrName)
- : AttributeBuilder.build(extAttrName, objValues.iterator().next()));
- }
- }
- }
-
- return result;
- }
-
- private String getGroupOwnerValue(final Provision provision, final Any<?, ?> any) {
- Pair<String, Attribute> preparedAttr = prepareAttr(provision, getConnObjectKeyItem(provision), any, null);
- String connObjectKey = preparedAttr.getKey();
-
- return evaluateNAME(any, provision, connObjectKey).getNameValue();
- }
-
- /**
- * Get attribute values for the given {@link MappingItem} and any objects.
- *
- * @param provision provision information
- * @param mappingItem mapping item
- * @param anys any objects
- * @return attribute values.
- */
- @Transactional(readOnly = true)
- public List<PlainAttrValue> getIntValues(final Provision provision,
- final MappingItem mappingItem, final List<Any<?, ?>> anys) {
-
- LOG.debug("Get attributes for '{}' and mapping type '{}'", anys, mappingItem.getIntMappingType());
-
- boolean transform = true;
-
- List<PlainAttrValue> values = new ArrayList<>();
- switch (mappingItem.getIntMappingType()) {
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- for (Any<?, ?> any : anys) {
- PlainAttr<?> attr = any.getPlainAttr(mappingItem.getIntAttrName());
- if (attr != null) {
- if (attr.getUniqueValue() != null) {
- PlainAttrUniqueValue value = SerializationUtils.clone(attr.getUniqueValue());
- value.setAttr(null);
- values.add(value);
- } else if (attr.getValues() != null) {
- for (PlainAttrValue value : attr.getValues()) {
- PlainAttrValue shadow = SerializationUtils.clone(value);
- shadow.setAttr(null);
- values.add(shadow);
- }
- }
- }
-
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
-
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case AnyObjectDerivedSchema:
- for (Any<?, ?> any : anys) {
- AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- DerAttr<?> attr = any.getDerAttr(mappingItem.getIntAttrName());
- if (attr != null) {
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- attrValue.setStringValue(attr.getValue(any.getPlainAttrs()));
- values.add(attrValue);
- }
-
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
- }
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- // virtual attributes don't get transformed
- transform = false;
-
- VirSchema virSchema = virSchemaDAO.find(mappingItem.getIntAttrName());
- if (virSchema != null) {
- for (Any<?, ?> any : anys) {
- LOG.debug("Expire entry cache {}-{}", any.getKey(), mappingItem.getIntAttrName());
- virAttrCache.expire(any.getType().getKey(), any.getKey(), mappingItem.getIntAttrName());
-
- AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- for (String value : virAttrHandler.getValues(any, virSchema)) {
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- attrValue.setStringValue(value);
- values.add(attrValue);
- }
-
- LOG.debug("Retrieved values for {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- virSchema.getKey(), mappingItem.getIntAttrName(), mappingItem.getIntMappingType(),
- values);
- }
- }
- break;
-
- case UserKey:
- case GroupKey:
- case AnyObjectKey:
- for (Any<?, ?> any : anys) {
- AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- attrValue.setStringValue(any.getKey().toString());
- values.add(attrValue);
- }
- break;
-
- case Username:
- for (Any<?, ?> any : anys) {
- if (any instanceof User) {
- UPlainAttrValue attrValue = entityFactory.newEntity(UPlainAttrValue.class);
- attrValue.setStringValue(((User) any).getUsername());
- values.add(attrValue);
- }
- }
- break;
-
- case GroupName:
- for (Any<?, ?> any : anys) {
- if (any instanceof Group) {
- GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
- attrValue.setStringValue(((Group) any).getName());
- values.add(attrValue);
- }
- }
- break;
-
- case GroupOwnerSchema:
- Mapping uMapping = provision.getAnyType().equals(anyTypeDAO.findUser())
- ? null
- : provision.getMapping();
- Mapping gMapping = provision.getAnyType().equals(anyTypeDAO.findGroup())
- ? null
- : provision.getMapping();
-
- for (Any<?, ?> any : anys) {
- if (any instanceof Group) {
- Group group = (Group) any;
- String groupOwnerValue = null;
- if (group.getUserOwner() != null && uMapping != null) {
- groupOwnerValue = getGroupOwnerValue(provision, group.getUserOwner());
- }
- if (group.getGroupOwner() != null && gMapping != null) {
- groupOwnerValue = getGroupOwnerValue(provision, group.getGroupOwner());
- }
-
- if (StringUtils.isNotBlank(groupOwnerValue)) {
- GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
- attrValue.setStringValue(groupOwnerValue);
- values.add(attrValue);
- }
- }
- }
- break;
-
- default:
- }
-
- LOG.debug("Values for propagation: {}", values);
-
- List<PlainAttrValue> transformed = values;
- if (transform) {
- for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItem)) {
- transformed = transformer.beforePropagation(transformed);
- }
- LOG.debug("Transformed values for propagation: {}", values);
- } else {
- LOG.debug("No transformation occurred");
- }
-
- return transformed;
- }
-
- /**
- * Get connObjectKey internal value.
- *
- * @param any any object
- * @param provision provision information
- * @return connObjectKey internal value
- */
- @Transactional(readOnly = true)
- public String getConnObjectKeyValue(final Any<?, ?> any, final Provision provision) {
- List<PlainAttrValue> values = getIntValues(provision, provision.getMapping().getConnObjectKeyItem(),
- Collections.<Any<?, ?>>singletonList(any));
- return values == null || values.isEmpty()
- ? null
- : values.get(0).getValueAsString();
- }
-
- /**
- * Set attribute values, according to the given {@link MappingItem}, to any object from attribute received from
- * connector.
- *
- * @param <T> any object
- * @param mappingItem mapping item
- * @param attr attribute received from connector
- * @param anyTO any object
- * @param anyUtils any utils
- */
- @Transactional(readOnly = true)
- public <T extends AnyTO> void setIntValues(
- final MappingItem mappingItem, final Attribute attr, final T anyTO, final AnyUtils anyUtils) {
-
- List<Object> values = null;
- if (attr != null) {
- values = attr.getValue();
- for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItem)) {
- values = transformer.beforeSync(values);
- }
- }
- values = ListUtils.emptyIfNull(values);
-
- switch (mappingItem.getIntMappingType()) {
- case UserKey:
- case GroupKey:
- case AnyObjectKey:
- break;
-
- case Password:
- if (anyTO instanceof UserTO && !values.isEmpty()) {
- ((UserTO) anyTO).setPassword(ConnObjectUtils.getPassword(values.get(0)));
- }
- break;
-
- case Username:
- if (anyTO instanceof UserTO) {
- ((UserTO) anyTO).setUsername(values.isEmpty() || values.get(0) == null
- ? null
- : values.get(0).toString());
- }
- break;
-
- case GroupName:
- if (anyTO instanceof GroupTO) {
- ((GroupTO) anyTO).setName(values.isEmpty() || values.get(0) == null
- ? null
- : values.get(0).toString());
- }
- break;
-
- case GroupOwnerSchema:
- if (anyTO instanceof GroupTO && attr != null) {
- // using a special attribute (with schema "", that will be ignored) for carrying the
- // GroupOwnerSchema value
- AttrTO attrTO = new AttrTO();
- attrTO.setSchema(StringUtils.EMPTY);
- if (values.isEmpty() || values.get(0) == null) {
- attrTO.getValues().add(StringUtils.EMPTY);
- } else {
- attrTO.getValues().add(values.get(0).toString());
- }
-
- ((GroupTO) anyTO).getPlainAttrs().add(attrTO);
- }
- break;
-
- case UserPlainSchema:
- case GroupPlainSchema:
- case AnyObjectPlainSchema:
- AttrTO attrTO = new AttrTO();
- attrTO.setSchema(mappingItem.getIntAttrName());
-
- PlainSchema schema = plainSchemaDAO.find(mappingItem.getIntAttrName());
-
- for (Object value : values) {
- AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
- if (value != null) {
- PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
- switch (schemaType) {
- case String:
- attrValue.setStringValue(value.toString());
- break;
-
- case Binary:
- attrValue.setBinaryValue((byte[]) value);
- break;
-
- default:
- try {
- attrValue.parseValue(schema, value.toString());
- } catch (ParsingValidationException e) {
- LOG.error("While parsing provided value {}", value, e);
- attrValue.setStringValue(value.toString());
- schemaType = AttrSchemaType.String;
- }
- break;
- }
- attrTO.getValues().add(attrValue.getValueAsString(schemaType));
- }
- }
-
- anyTO.getPlainAttrs().add(attrTO);
- break;
-
- case UserDerivedSchema:
- case GroupDerivedSchema:
- case AnyObjectDerivedSchema:
- attrTO = new AttrTO();
- attrTO.setSchema(mappingItem.getIntAttrName());
- anyTO.getDerAttrs().add(attrTO);
- break;
-
- case UserVirtualSchema:
- case GroupVirtualSchema:
- case AnyObjectVirtualSchema:
- attrTO = new AttrTO();
- attrTO.setSchema(mappingItem.getIntAttrName());
-
- // virtual attributes don't get transformed, iterate over original attr.getValue()
- for (Object value : (attr == null || attr.getValue() == null)
- ? Collections.emptyList() : attr.getValue()) {
-
- if (value != null) {
- attrTO.getValues().add(value.toString());
- }
- }
-
- anyTO.getVirAttrs().add(attrTO);
- break;
-
- default:
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java
deleted file mode 100644
index d8bacdb..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/RealmUtils.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.misc;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-public final class RealmUtils {
-
- public static String getGroupOwnerRealm(final String realmPath, final Long groupKey) {
- return realmPath + "@" + groupKey;
- }
-
- public static boolean normalizingAddTo(final Set<String> realms, final String newRealm) {
- boolean dontAdd = false;
- Set<String> toRemove = new HashSet<>();
- for (String realm : realms) {
- if (newRealm.startsWith(realm)) {
- dontAdd = true;
- } else if (realm.startsWith(newRealm)) {
- toRemove.add(realm);
- }
- }
-
- realms.removeAll(toRemove);
- if (!dontAdd) {
- realms.add(newRealm);
- }
- return !dontAdd;
- }
-
- public static Set<String> normalize(final Collection<String> realms) {
- Set<String> normalized = new HashSet<>();
- for (String realm : realms) {
- normalizingAddTo(normalized, realm);
- }
-
- return normalized;
- }
-
- private RealmUtils() {
- // empty constructor for static utility class
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/TemplateUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/TemplateUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/TemplateUtils.java
deleted file mode 100644
index d990cdb..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/TemplateUtils.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.misc;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-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.MembershipTO;
-import org.apache.syncope.common.lib.to.RelationshipTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.core.misc.jexl.JexlUtils;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.AnyTemplate;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-public class TemplateUtils {
-
- @Autowired
- private UserDAO userDAO;
-
- @Autowired
- private GroupDAO groupDAO;
-
- private AttrTO evaluateAttr(final AnyTO anyTO, final AttrTO template) {
- AttrTO result = new AttrTO();
- result.setSchema(template.getSchema());
-
- if (template.getValues() != null && !template.getValues().isEmpty()) {
- for (String value : template.getValues()) {
- String evaluated = JexlUtils.evaluate(value, anyTO);
- if (StringUtils.isNotBlank(evaluated)) {
- result.getValues().add(evaluated);
- }
- }
- }
-
- return result;
- }
-
- private void fill(final AnyTO anyTO, final AnyTO template) {
- if (template.getRealm() != null) {
- anyTO.setRealm(template.getRealm());
- }
-
- Map<String, AttrTO> currentAttrMap = anyTO.getPlainAttrMap();
- for (AttrTO templatePlainAttr : template.getPlainAttrs()) {
- if (!templatePlainAttr.getValues().isEmpty()
- && (!currentAttrMap.containsKey(templatePlainAttr.getSchema())
- || currentAttrMap.get(templatePlainAttr.getSchema()).getValues().isEmpty())) {
-
- anyTO.getPlainAttrs().add(evaluateAttr(anyTO, templatePlainAttr));
- }
- }
-
- currentAttrMap = anyTO.getDerAttrMap();
- for (AttrTO templateDerAttr : template.getDerAttrs()) {
- if (!currentAttrMap.containsKey(templateDerAttr.getSchema())) {
- anyTO.getDerAttrs().add(templateDerAttr);
- }
- }
-
- currentAttrMap = anyTO.getVirAttrMap();
- for (AttrTO templateVirAttr : template.getVirAttrs()) {
- if (!templateVirAttr.getValues().isEmpty()
- && (!currentAttrMap.containsKey(templateVirAttr.getSchema())
- || currentAttrMap.get(templateVirAttr.getSchema()).getValues().isEmpty())) {
-
- anyTO.getVirAttrs().add(evaluateAttr(anyTO, templateVirAttr));
- }
- }
-
- for (String resource : template.getResources()) {
- anyTO.getResources().add(resource);
- }
-
- anyTO.getAuxClasses().addAll(template.getAuxClasses());
- }
-
- private void fillRelationships(final Map<Long, RelationshipTO> anyRelMap,
- final List<RelationshipTO> anyRels, final List<RelationshipTO> templateRels) {
-
- for (RelationshipTO memb : templateRels) {
- if (!anyRelMap.containsKey(memb.getRightKey())) {
- anyRels.add(memb);
- }
- }
- }
-
- private void fillMemberships(final Map<Long, MembershipTO> anyMembMap,
- final List<MembershipTO> anyMembs, final List<MembershipTO> templateMembs) {
-
- for (MembershipTO memb : templateMembs) {
- if (!anyMembMap.containsKey(memb.getRightKey())) {
- anyMembs.add(memb);
- }
- }
- }
-
- @Transactional(readOnly = true)
- public <T extends AnyTO> void apply(final T anyTO, final AnyTemplate anyTemplate) {
- if (anyTemplate != null) {
- AnyTO template = anyTemplate.get();
- fill(anyTO, template);
-
- if (template instanceof AnyObjectTO) {
- fillRelationships(((AnyObjectTO) anyTO).getRelationshipMap(),
- ((AnyObjectTO) anyTO).getRelationships(), ((AnyObjectTO) template).getRelationships());
- fillMemberships(((AnyObjectTO) anyTO).getMembershipMap(),
- ((AnyObjectTO) anyTO).getMemberships(), ((AnyObjectTO) template).getMemberships());
- } else if (template instanceof UserTO) {
- if (StringUtils.isNotBlank(((UserTO) template).getUsername())) {
- String evaluated = JexlUtils.evaluate(((UserTO) template).getUsername(), anyTO);
- if (StringUtils.isNotBlank(evaluated)) {
- ((UserTO) anyTO).setUsername(evaluated);
- }
- }
-
- if (StringUtils.isNotBlank(((UserTO) template).getPassword())) {
- String evaluated = JexlUtils.evaluate(((UserTO) template).getPassword(), anyTO);
- if (StringUtils.isNotBlank(evaluated)) {
- ((UserTO) anyTO).setPassword(evaluated);
- }
- }
-
- fillRelationships(((UserTO) anyTO).getRelationshipMap(),
- ((UserTO) anyTO).getRelationships(), ((UserTO) template).getRelationships());
- fillMemberships(((UserTO) anyTO).getMembershipMap(),
- ((UserTO) anyTO).getMemberships(), ((UserTO) template).getMemberships());
- } else if (template instanceof GroupTO) {
- if (StringUtils.isNotBlank(((GroupTO) template).getName())) {
- String evaluated = JexlUtils.evaluate(((GroupTO) template).getName(), anyTO);
- if (StringUtils.isNotBlank(evaluated)) {
- ((GroupTO) anyTO).setName(evaluated);
- }
- }
-
- if (((GroupTO) template).getUserOwner() != null) {
- final User userOwner = userDAO.find(((GroupTO) template).getUserOwner());
- if (userOwner != null) {
- ((GroupTO) anyTO).setUserOwner(userOwner.getKey());
- }
- }
- if (((GroupTO) template).getGroupOwner() != null) {
- final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner());
- if (groupOwner != null) {
- ((GroupTO) anyTO).setGroupOwner(groupOwner.getKey());
- }
- }
- }
- }
- }
-
- public void check(final Map<String, AnyTO> templates, final ClientExceptionType clientExceptionType) {
- SyncopeClientException sce = SyncopeClientException.build(clientExceptionType);
-
- for (Map.Entry<String, AnyTO> entry : templates.entrySet()) {
- for (AttrTO attrTO : entry.getValue().getPlainAttrs()) {
- if (!attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))) {
- sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0));
- }
- }
-
- for (AttrTO attrTO : entry.getValue().getVirAttrs()) {
- if (!attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))) {
- sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0));
- }
- }
-
- if (entry.getValue() instanceof UserTO) {
- UserTO template = (UserTO) entry.getValue();
- if (StringUtils.isNotBlank(template.getUsername())
- && !JexlUtils.isExpressionValid(template.getUsername())) {
-
- sce.getElements().add("Invalid JEXL: " + template.getUsername());
- }
- if (StringUtils.isNotBlank(template.getPassword())
- && !JexlUtils.isExpressionValid(template.getPassword())) {
-
- sce.getElements().add("Invalid JEXL: " + template.getPassword());
- }
- } else if (entry.getValue() instanceof GroupTO) {
- GroupTO template = (GroupTO) entry.getValue();
- if (StringUtils.isNotBlank(template.getName())
- && !JexlUtils.isExpressionValid(template.getName())) {
-
- sce.getElements().add("Invalid JEXL: " + template.getName());
- }
- }
- }
-
- if (!sce.isEmpty()) {
- throw sce;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
index 3afe6e5..2870eae 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtils.java
@@ -35,7 +35,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.core.persistence.api.entity.DerAttr;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.PlainAttr;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthDataAccessor.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthDataAccessor.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthDataAccessor.java
index 7dc576a..f281fd3 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthDataAccessor.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthDataAccessor.java
@@ -36,8 +36,8 @@ import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.MappingUtils;
-import org.apache.syncope.core.misc.RealmUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
+import org.apache.syncope.core.misc.utils.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.DomainDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
index 100de17..198b1e8 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/SyncopeGrantedAuthority.java
@@ -29,7 +29,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.syncope.core.misc.RealmUtils;
+import org.apache.syncope.core.misc.utils.RealmUtils;
import org.springframework.security.core.GrantedAuthority;
public class SyncopeGrantedAuthority implements GrantedAuthority {
[02/50] [abbrv] syncope git commit: Upgrading Tomcat
Posted by fm...@apache.org.
Upgrading Tomcat
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d2f57abd
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d2f57abd
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d2f57abd
Branch: refs/heads/SYNCOPE-156
Commit: d2f57abd7840fe912f5a4cb07a6a78455b78d6da
Parents: 4dd3455
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Oct 21 12:22:58 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Oct 21 12:22:58 2015 +0200
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d2f57abd/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7c0e39a..3b74d7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -375,7 +375,7 @@ under the License.
<httpclient.version>4.3.6</httpclient.version>
- <tomcat.version>7.0.64</tomcat.version>
+ <tomcat.version>7.0.65</tomcat.version>
<jasypt.version>1.9.2</jasypt.version>
[21/50] [abbrv] syncope git commit: [SYNCOPE-141] Preliminary changes
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/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 77efd28..192b26d 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
@@ -43,8 +43,8 @@ import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.misc.ConnObjectUtils;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.ConnObjectUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.apache.syncope.core.persistence.api.dao.AnyDAO;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
index e0d3d59..f938faf 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
@@ -37,7 +37,7 @@ import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.provisioning.api.sync.PushActions;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyUtils;
import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
index 570cb76..d4bef63 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncopeResultHandler.java
@@ -32,7 +32,7 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecu
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
import org.apache.syncope.core.provisioning.api.sync.SyncopeResultHandler;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.ConnObjectUtils;
+import org.apache.syncope.core.misc.utils.ConnObjectUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyUtils;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
index 1ed0d2c..34fde4d 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
@@ -18,13 +18,13 @@
*/
package org.apache.syncope.core.provisioning.java.sync;
-import static org.apache.syncope.core.misc.MappingUtils.getMappingItemTransformers;
+import static org.apache.syncope.core.misc.utils.MappingUtils.getMappingItemTransformers;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
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.SearchCond;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
index d3a4a4d..b8e1522 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
@@ -27,7 +27,7 @@ import java.util.Set;
import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.policy.SyncPolicySpec;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
index 4fa504e..b0c4161 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
@@ -25,7 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.policy.SyncPolicySpec;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.misc.serialization.POJOHelper;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.dao.AnyDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioning.properties b/core/provisioning-java/src/main/resources/provisioning.properties
index 59e5916..55f9ead 100644
--- a/core/provisioning-java/src/main/resources/provisioning.properties
+++ b/core/provisioning-java/src/main/resources/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/resources/provisioningContext.xml
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioningContext.xml b/core/provisioning-java/src/main/resources/provisioningContext.xml
index 4d635d2..7fcafc7 100644
--- a/core/provisioning-java/src/main/resources/provisioningContext.xml
+++ b/core/provisioning-java/src/main/resources/provisioningContext.xml
@@ -28,8 +28,13 @@ under the License.
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd">
- <task:annotation-driven executor="connectorExecutor"/>
- <task:executor id="connectorExecutor" pool-size="10"/>
+ <context:component-scan base-package="org.apache.syncope.core.provisioning.java"/>
+
+ <!-- Used by AsyncConnectorFacade -->
+ <task:annotation-driven executor="AsyncConnectorFacadeExecutor"/>
+ <task:executor id="AsyncConnectorFacadeExecutor" pool-size="${asyncConnectorFacadeExecutor.poolSize}"/>
+
+ <bean class="${propagationTaskExecutor}"/>
<bean class="${userProvisioningManager}"/>
<bean class="${groupProvisioningManager}"/>
@@ -102,9 +107,6 @@ under the License.
<bean class="org.apache.syncope.core.provisioning.java.propagation.PropagationManagerImpl"/>
<bean class="org.apache.syncope.core.provisioning.java.propagation.DefaultPropagationReporter" scope="prototype"/>
- <context:component-scan base-package="org.apache.syncope.core.misc"/>
- <context:component-scan base-package="org.apache.syncope.core.provisioning.java"/>
-
<bean id="virAttrCache" class="${virAttrCache}" scope="singleton">
<constructor-arg value="60"/>
<constructor-arg value="5000"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
index e26f238..1193e16 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/AbstractTest.java
@@ -27,6 +27,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
"classpath:persistenceTest.xml",
"classpath:provisioningContext.xml",
"classpath:workflowContext.xml",
+ "classpath:utilsContext.xml",
"classpath:provisioningTest.xml"
})
public abstract class AbstractTest {
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/MappingTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/MappingTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/MappingTest.java
index 8bf191e..91486ab 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/MappingTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/MappingTest.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.provisioning.java;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/ThreadLocalCleanupListener.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/ThreadLocalCleanupListener.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/ThreadLocalCleanupListener.java
index fe19915..f767c19 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/ThreadLocalCleanupListener.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/ThreadLocalCleanupListener.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.rest.cxf;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.identityconnectors.common.l10n.CurrentLocale;
import org.identityconnectors.framework.impl.api.local.ThreadClassLoaderManager;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
index 763f666..ab3b256 100644
--- a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
+++ b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
camel.directory=${conf.directory}
+
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelAnyObjectProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/pom.xml b/fit/core-reference/pom.xml
index 4a3df61..3d8af35 100644
--- a/fit/core-reference/pom.xml
+++ b/fit/core-reference/pom.xml
@@ -770,6 +770,7 @@ under the License.
<resource>
<directory>${basedir}/../../core/misc/target/classes</directory>
<excludes>
+ <exclude>utilsContext.xml</exclude>
<exclude>securityContext.xml</exclude>
</excludes>
</resource>
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/all/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/all/provisioning.properties b/fit/core-reference/src/main/resources/all/provisioning.properties
index 336ed21..9c979a2 100644
--- a/fit/core-reference/src/main/resources/all/provisioning.properties
+++ b/fit/core-reference/src/main/resources/all/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
camel.directory=${conf.directory}
+
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelAnyObjectProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/mariadb/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/mariadb/provisioning.properties b/fit/core-reference/src/main/resources/mariadb/provisioning.properties
index 4a0c415..ca365dc 100644
--- a/fit/core-reference/src/main/resources/mariadb/provisioning.properties
+++ b/fit/core-reference/src/main/resources/mariadb/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
@@ -21,4 +24,4 @@ virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
quartz.jobstore=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
quartz.sql=tables_mariadb.sql
-quartz.scheduler.idleWaitTime=5000
\ No newline at end of file
+quartz.scheduler.idleWaitTime=5000
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/mysql/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/mysql/provisioning.properties b/fit/core-reference/src/main/resources/mysql/provisioning.properties
index ac8306a..428be67 100644
--- a/fit/core-reference/src/main/resources/mysql/provisioning.properties
+++ b/fit/core-reference/src/main/resources/mysql/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
@@ -21,4 +24,4 @@ virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
quartz.jobstore=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
quartz.sql=tables_mysql.sql
-quartz.scheduler.idleWaitTime=5000
\ No newline at end of file
+quartz.scheduler.idleWaitTime=5000
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/oracle/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/oracle/provisioning.properties b/fit/core-reference/src/main/resources/oracle/provisioning.properties
index 22071c0..a507de0 100644
--- a/fit/core-reference/src/main/resources/oracle/provisioning.properties
+++ b/fit/core-reference/src/main/resources/oracle/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
@@ -21,4 +24,4 @@ virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
quartz.jobstore=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
quartz.sql=tables_oracle.sql
-quartz.scheduler.idleWaitTime=5000
\ No newline at end of file
+quartz.scheduler.idleWaitTime=5000
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/postgres/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/postgres/provisioning.properties b/fit/core-reference/src/main/resources/postgres/provisioning.properties
index 66340bb..1be02bf 100644
--- a/fit/core-reference/src/main/resources/postgres/provisioning.properties
+++ b/fit/core-reference/src/main/resources/postgres/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
@@ -21,4 +24,4 @@ virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
quartz.jobstore=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
quartz.sql=tables_postgres.sql
-quartz.scheduler.idleWaitTime=5000
\ No newline at end of file
+quartz.scheduler.idleWaitTime=5000
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/provisioning.properties b/fit/core-reference/src/main/resources/provisioning.properties
index a67787f..a14ae19 100644
--- a/fit/core-reference/src/main/resources/provisioning.properties
+++ b/fit/core-reference/src/main/resources/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
@@ -21,4 +24,4 @@ virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
quartz.jobstore=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
quartz.sql=tables_h2.sql
-quartz.scheduler.idleWaitTime=5000
\ No newline at end of file
+quartz.scheduler.idleWaitTime=5000
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/sqlserver/provisioning.properties b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
index 5e0088e..4cb4b80 100644
--- a/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
+++ b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+asyncConnectorFacadeExecutor.poolSize=10
+propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
+
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
groupProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultGroupProvisioningManager
anyObjectProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultAnyObjectProvisioningManager
@@ -21,4 +24,4 @@ virAttrCache=org.apache.syncope.core.provisioning.java.cache.MemoryVirAttrCache
quartz.jobstore=org.quartz.impl.jdbcjobstore.MSSQLDelegate
quartz.sql=tables_sqlServer.sql
-quartz.scheduler.idleWaitTime=5000
\ No newline at end of file
+quartz.scheduler.idleWaitTime=5000
[05/50] [abbrv] syncope git commit: [SYNCOPE-714] Consolidating old
buildSchemaNames and buildSupportedObjectClasses into new buildO
bjectClassInfo
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
index f3ade5e..6033bd4 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
@@ -104,8 +104,8 @@ public class ConnInstanceTest extends AbstractTest {
conf.add(servicename);
// set connector configuration
- connInstance.setConfiguration(conf);
- assertFalse(connInstance.getConfiguration().isEmpty());
+ connInstance.setConf(conf);
+ assertFalse(connInstance.getConf().isEmpty());
// perform save operation
ConnInstance actual = connInstanceDAO.save(connInstance);
@@ -125,7 +125,7 @@ public class ConnInstanceTest extends AbstractTest {
assertEquals(60, actual.getConnRequestTimeout(), 0);
- conf = connInstance.getConfiguration();
+ conf = connInstance.getConf();
assertFalse(conf.isEmpty());
assertNotNull("configuration retrieving failed", conf);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
index d9f79fc..f557e8c 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/ConnInstanceTest.java
@@ -85,7 +85,7 @@ public class ConnInstanceTest extends AbstractTest {
|| "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(2).getKey())
|| "ws-target-resource-nopropagation".equalsIgnoreCase(resources.get(3).getKey()));
- connInstance.addCapability(ConnectorCapability.SEARCH);
+ connInstance.getCapabilities().add(ConnectorCapability.SEARCH);
connInstance = connInstanceDAO.save(connInstance);
assertNotNull(connInstance);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
index d1fde9e..2bc840d 100644
--- a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
@@ -580,54 +580,55 @@ under the License.
<ConnInstance_capabilities ConnInstance_id="108" capability="SYNC"/>
<ExternalResource name="ws-target-resource-1" connector_id="100"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="0"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="1" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
- creator="admin" lastModifier="admin"
+ creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-2" connector_id="100"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="FAILURES" deleteTraceLevel="NONE" updateTraceLevel="ALL" syncTraceLevel="ALL"
syncPolicy_id="9"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-timeout" connector_id="102"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="1" createTraceLevel="FAILURES" deleteTraceLevel="NONE" updateTraceLevel="ALL" syncTraceLevel="ALL"
jsonConf='[{"schema":{"name":"endpoint","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":true,"values":["http://localhost:${cargo.servlet.port}/syncope-fit-build-tools/services/provisioning"]}]'
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-list-mappings-1" connector_id="100"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="0"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-list-mappings-2" connector_id="100"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-delete" connector_id="102"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="0"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
propagationPriority="2" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-update" connector_id="100"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-testdb" connector_id="101"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-testdb2" connector_id="106"
- randomPwdIfNotProvided="1" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="1" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-csv" connector_id="104"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="0" syncPolicy_id="3"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
+ syncPolicy_id="3"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -636,7 +637,7 @@ under the License.
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-ldap" connector_id="105"
- randomPwdIfNotProvided="1" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="1" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="1"
createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
@@ -644,22 +645,25 @@ under the License.
<ExternalResource_PropActions resource_name="resource-ldap"
actionClassName="org.apache.syncope.core.provisioning.java.propagation.LDAPMembershipPropagationActions"/>
<ExternalResource name="ws-target-resource-nopropagation" connector_id="103"
- randomPwdIfNotProvided="0" enforceMandatoryCondition="1"
+ randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
passwordPolicy_id="4"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <!-- The following three resources has been added to verify the issue SYNCOPE-68 -->
- <ExternalResource name="ws-target-resource-nopropagation2" connector_id="103" enforceMandatoryCondition="1"
+ <!-- The following three resources have been added to verify the issue SYNCOPE-68 -->
+ <ExternalResource name="ws-target-resource-nopropagation2" connector_id="103"
+ enforceMandatoryCondition="1" overrideCapabilities="0"
randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <ExternalResource name="ws-target-resource-nopropagation3" connector_id="103" enforceMandatoryCondition="1"
+ <ExternalResource name="ws-target-resource-nopropagation3" connector_id="103"
+ enforceMandatoryCondition="1" overrideCapabilities="0"
randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
- <ExternalResource name="ws-target-resource-nopropagation4" connector_id="103" enforceMandatoryCondition="1"
+ <ExternalResource name="ws-target-resource-nopropagation4" connector_id="103"
+ enforceMandatoryCondition="1" overrideCapabilities="0"
randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -668,7 +672,7 @@ under the License.
<ExternalResource name="resource-db-sync" connector_id="107"
randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" syncTraceLevel="ALL" updateTraceLevel="ALL"
enforceMandatoryCondition="0"
- propagationPrimary="0" propagationPriority="0"
+ propagationPrimary="0" propagationPriority="0" overrideCapabilities="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -676,14 +680,14 @@ under the License.
<ExternalResource name="resource-db-virattr" connector_id="107"
randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" syncTraceLevel="ALL" updateTraceLevel="ALL"
enforceMandatoryCondition="0"
- propagationPrimary="0" propagationPriority="0"
+ propagationPrimary="0" propagationPriority="0" overrideCapabilities="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-db-scripted" connector_id="108"
randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" syncTraceLevel="ALL" updateTraceLevel="ALL"
enforceMandatoryCondition="0"
- propagationPrimary="0" propagationPriority="0"
+ propagationPrimary="0" propagationPriority="0" overrideCapabilities="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
index 186dbbb..242202f 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnIdBundleManager.java
@@ -31,7 +31,7 @@ import org.identityconnectors.framework.api.ConnectorInfoManager;
*/
public interface ConnIdBundleManager {
- ConfigurationProperties getConfigurationProperties(final ConnectorInfo info);
+ ConfigurationProperties getConfigurationProperties(ConnectorInfo info);
Map<URI, ConnectorInfoManager> getConnManagers();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
index ce8adba..2a3a0a1 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/Connector.java
@@ -28,6 +28,7 @@ import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
import org.identityconnectors.framework.common.objects.Attribute;
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.SyncResultsHandler;
@@ -134,8 +135,7 @@ public interface Connector {
ConnectorObject getObject(ObjectClass objectClass, Uid uid, OperationOptions options);
/**
- * Get remote object used by the propagation manager in order to choose for a create (object doesn't exist) or an
- * update (object exists).
+ * Get remote object with check for intended operation to perform on external resource.
*
* @param operationType resource operation type
* @param objectClass ConnId's object class
@@ -186,40 +186,11 @@ public interface Connector {
Iterator<? extends MappingItem> mapItems);
/**
- * Read attribute for a given connector object.
+ * Builds metadata description of ConnId {@link ObjectClass}.
*
- * @param objectClass ConnId's object class
- * @param uid ConnId's Uid
- * @param options ConnId's OperationOptions
- * @param attributeName attribute to read
- * @return attribute (if present)
- */
- Attribute getObjectAttribute(ObjectClass objectClass, Uid uid, OperationOptions options, String attributeName);
-
- /**
- * Read attributes for a given connector object.
- *
- * @param objectClass ConnId's object class
- * @param uid ConnId's Uid
- * @param options ConnId's OperationOptions
- * @return attributes (if present)
+ * @return metadata description of ConnId ObjectClass
*/
- Set<Attribute> getObjectAttributes(ObjectClass objectClass, Uid uid, OperationOptions options);
-
- /**
- * Return resource schema names.
- *
- * @param includeSpecial return special attributes (like as __NAME__ or __PASSWORD__) if true
- * @return schema names
- */
- Set<String> getSchemaNames(boolean includeSpecial);
-
- /**
- * Return ConnId's object classes supported by this connector.
- *
- * @return supported object classes
- */
- Set<ObjectClass> getSupportedObjectClasses();
+ Set<ObjectClassInfo> getObjectClassInfo();
/**
* Validate a connector instance.
@@ -236,14 +207,5 @@ public interface Connector {
*
* @return active connector instance.
*/
- ConnInstance getActiveConnInstance();
-
- /**
- * Build options for requesting all mapped connector attributes.
- *
- * @param mapItems mapping items
- * @return options for requesting all mapped connector attributes
- * @see OperationOptions
- */
- OperationOptions getOperationOptions(Iterator<? extends MappingItem> mapItems);
+ ConnInstance getConnInstance();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorFactory.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorFactory.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorFactory.java
index 6d2d0c8..4c6dd82 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorFactory.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorFactory.java
@@ -20,7 +20,7 @@ package org.apache.syncope.core.provisioning.api;
import java.util.Set;
import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.core.persistence.api.SyncopeLoader;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
@@ -29,16 +29,28 @@ import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
*
* @see Connector
*/
-public interface ConnectorFactory extends SyncopeLoader {
+public interface ConnectorFactory {
/**
- * Create connector from given connector instance and configuration properties.
+ * Builds connector instance override over base connector instance, configuration and capabilities override.
+ *
+ * @param connInstance base connector instance
+ * @param confOverride configuration override
+ * @param capabilitiesOverride capabilities override
+ * @return connector instance override over base connector instance, configuration and capabilities override
+ */
+ ConnInstance buildConnInstanceOverride(
+ ConnInstance connInstance,
+ Set<ConnConfProperty> confOverride,
+ Set<ConnectorCapability> capabilitiesOverride);
+
+ /**
+ * Create connector from given connector instance.
*
* @param connInstance connector instance
- * @param configuration configuration properties
* @return connector
*/
- Connector createConnector(ConnInstance connInstance, Set<ConnConfProperty> configuration);
+ Connector createConnector(ConnInstance connInstance);
/**
* Get existing connector for the given resource.
@@ -53,7 +65,6 @@ public interface ConnectorFactory extends SyncopeLoader {
*
* @see ExternalResource
*/
- @Override
void load();
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorRegistry.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorRegistry.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorRegistry.java
index 1bcbcbc..c1cc547 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorRegistry.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ConnectorRegistry.java
@@ -18,9 +18,6 @@
*/
package org.apache.syncope.core.provisioning.api;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
/**
@@ -29,15 +26,6 @@ import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
public interface ConnectorRegistry {
/**
- * Returns a connector instance with overridden property values, if found.
- *
- * @param connInstance base connector instance
- * @param overridden overridden property values
- * @return connector instance with overridden property values, if found
- */
- ConnInstance getOverriddenConnInstance(ConnInstance connInstance, Set<ConnConfProperty> overridden);
-
- /**
* Create and register into Spring context a bean for the given resource.
*
* @param resource external resource
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConnInstanceDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConnInstanceDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConnInstanceDataBinder.java
index d3496a2..373d1af 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConnInstanceDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConnInstanceDataBinder.java
@@ -18,31 +18,19 @@
*/
package org.apache.syncope.core.provisioning.api.data;
-import java.util.Set;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.types.ConnConfPropSchema;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.identityconnectors.framework.api.ConfigurationProperty;
public interface ConnInstanceDataBinder {
- ConnConfPropSchema buildConnConfPropSchema(ConfigurationProperty property);
+ ConnConfPropSchema build(ConfigurationProperty property);
ConnInstance getConnInstance(ConnInstanceTO connInstanceTO);
ConnInstanceTO getConnInstanceTO(ConnInstance connInstance);
- /**
- * Merge connector configuration properties avoiding repetition but giving priority to primary set.
- *
- * @param primary primary set.
- * @param secondary secondary set.
- * @return merged set.
- */
- Set<ConnConfProperty> mergeConnConfProperties(Set<ConnConfProperty> primary,
- Set<ConnConfProperty> secondary);
-
- ConnInstance updateConnInstance(long connInstanceId, ConnInstanceTO connInstanceTO);
+ ConnInstance update(long key, ConnInstanceTO connInstanceTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
index 2d96d71..9f1ea5d 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java
@@ -19,17 +19,14 @@
package org.apache.syncope.core.provisioning.api.data;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
public interface ResourceDataBinder {
- ExternalResource create(ResourceTO resourceTO);
-
- ConnInstance getConnInstance(ResourceTO resourceTO);
-
ResourceTO getResourceTO(ExternalResource resource);
+ ExternalResource create(ResourceTO resourceTO);
+
ExternalResource update(ExternalResource resource, ResourceTO resourceTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/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 0b4340e..83a38eb 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
@@ -18,19 +18,16 @@
*/
package org.apache.syncope.core.provisioning.java;
-import java.util.HashSet;
+import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Future;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.api.ConnectorFacade;
import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeInfo;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
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.Schema;
import org.identityconnectors.framework.common.objects.SyncToken;
import org.identityconnectors.framework.common.objects.Uid;
import org.slf4j.Logger;
@@ -46,9 +43,6 @@ import org.springframework.stereotype.Component;
@Component
public class AsyncConnectorFacade {
- /**
- * Logger.
- */
private static final Logger LOG = LoggerFactory.getLogger(AsyncConnectorFacade.class);
@Async
@@ -111,83 +105,17 @@ public class AsyncConnectorFacade {
}
@Async
- public Future<Attribute> getObjectAttribute(
- final ConnectorFacade connector,
- final ObjectClass objectClass,
- final Uid uid,
- final OperationOptions options,
- final String attributeName) {
-
- Attribute attribute = null;
-
- ConnectorObject object = connector.getObject(objectClass, uid, options);
- if (object == null) {
- LOG.debug("Object for '{}' not found", uid.getUidValue());
- } else {
- attribute = object.getAttributeByName(attributeName);
- }
-
- return new AsyncResult<>(attribute);
- }
-
- @Async
- public Future<Set<Attribute>> getObjectAttributes(
- final ConnectorFacade connector,
- final ObjectClass objectClass,
- final Uid uid,
- final OperationOptions options) {
-
- Set<Attribute> attributes = new HashSet<>();
-
- ConnectorObject object = connector.getObject(objectClass, uid, options);
-
- if (object == null) {
- LOG.debug("Object for '{}' not found", uid.getUidValue());
- } else {
- for (String attribute : options.getAttributesToGet()) {
- attributes.add(object.getAttributeByName(attribute));
- }
- }
-
- return new AsyncResult<>(attributes);
- }
-
- @Async
- public Future<Set<String>> getSchemaNames(final ConnectorFacade connector, final boolean includeSpecial) {
- Set<String> schemaNames = new HashSet<>();
-
- try {
- Schema schema = connector.schema();
- for (ObjectClassInfo info : schema.getObjectClassInfo()) {
- for (AttributeInfo attrInfo : info.getAttributeInfo()) {
- if (includeSpecial || !AttributeUtil.isSpecialName(attrInfo.getName())) {
- schemaNames.add(attrInfo.getName());
- }
- }
- }
- } catch (Exception e) {
- // catch exception in order to manage unpredictable behaviors
- LOG.debug("While reading schema on connector {}", connector, e);
- }
-
- return new AsyncResult<>(schemaNames);
- }
-
- @Async
- public Future<Set<ObjectClass>> getSupportedObjectClasses(final ConnectorFacade connector) {
- Set<ObjectClass> objectClasses = new HashSet<>();
+ public Future<Set<ObjectClassInfo>> getObjectClassInfo(final ConnectorFacade connector) {
+ Set<ObjectClassInfo> result = Collections.emptySet();
try {
- Schema schema = connector.schema();
- for (ObjectClassInfo info : schema.getObjectClassInfo()) {
- objectClasses.add(new ObjectClass(info.getType()));
- }
+ result = connector.schema().getObjectClassInfo();
} catch (Exception e) {
// catch exception in order to manage unpredictable behaviors
LOG.debug("While reading schema on connector {}", connector, e);
}
- return new AsyncResult<>(objectClasses);
+ return new AsyncResult<>(result);
}
@Async
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/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 6c2be32..a3b865f 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
@@ -21,7 +21,6 @@ package org.apache.syncope.core.provisioning.java;
import java.io.File;
import java.net.URI;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -31,8 +30,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.core.misc.MappingUtils;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
import org.apache.syncope.core.provisioning.api.ConnPoolConfUtils;
@@ -50,11 +49,10 @@ import org.identityconnectors.framework.api.ConnectorFacadeFactory;
import org.identityconnectors.framework.api.ConnectorInfo;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
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.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
import org.identityconnectors.framework.common.objects.ResultsHandler;
import org.identityconnectors.framework.common.objects.SearchResult;
import org.identityconnectors.framework.common.objects.SortKey;
@@ -84,7 +82,7 @@ public class ConnectorFacadeProxy implements Connector {
/**
* Active connector instance.
*/
- private final ConnInstance activeConnInstance;
+ private final ConnInstance connInstance;
@Autowired
private AsyncConnectorFacade asyncFacade;
@@ -92,14 +90,14 @@ public class ConnectorFacadeProxy implements Connector {
/**
* Use the passed connector instance to build a ConnectorFacade that will be used to make all wrapped calls.
*
- * @param connInstance the connector instance configuration
+ * @param connInstance the connector instance
* @see ConnectorInfo
* @see APIConfiguration
* @see ConfigurationProperties
* @see ConnectorFacade
*/
public ConnectorFacadeProxy(final ConnInstance connInstance) {
- this.activeConnInstance = connInstance;
+ this.connInstance = connInstance;
ConnIdBundleManager connIdBundleManager =
ApplicationContextProvider.getBeanFactory().getBean(ConnIdBundleManager.class);
@@ -112,7 +110,7 @@ public class ConnectorFacadeProxy implements Connector {
// set connector configuration according to conninstance's
ConfigurationProperties properties = apiConfig.getConfigurationProperties();
- for (ConnConfProperty property : connInstance.getConfiguration()) {
+ for (ConnConfProperty property : connInstance.getConf()) {
if (property.getValues() != null && !property.getValues().isEmpty()) {
properties.setPropertyValue(property.getSchema().getName(),
getPropertyValue(property.getSchema().getType(), property.getValues()));
@@ -140,11 +138,11 @@ public class ConnectorFacadeProxy implements Connector {
public Uid authenticate(final String username, final String password, final OperationOptions options) {
Uid result = null;
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.AUTHENTICATE)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.AUTHENTICATE)) {
Future<Uid> future = asyncFacade.authenticate(
connector, username, new GuardedString(password.toCharArray()), options);
try {
- result = future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -158,7 +156,7 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("Authenticate was attempted, although the connector only has these capabilities: {}. No action.",
- activeConnInstance.getCapabilities());
+ connInstance.getCapabilities());
}
return result;
@@ -173,12 +171,12 @@ public class ConnectorFacadeProxy implements Connector {
Uid result = null;
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.CREATE)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.CREATE)) {
propagationAttempted[0] = true;
Future<Uid> future = asyncFacade.create(connector, objectClass, attrs, options);
try {
- result = future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -192,7 +190,7 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("Create was attempted, although the connector only has these capabilities: {}. No action.",
- activeConnInstance.getCapabilities());
+ connInstance.getCapabilities());
}
return result;
@@ -208,13 +206,13 @@ public class ConnectorFacadeProxy implements Connector {
Uid result = null;
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.UPDATE)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.UPDATE)) {
propagationAttempted[0] = true;
Future<Uid> future = asyncFacade.update(connector, objectClass, uid, attrs, options);
try {
- result = future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -228,7 +226,7 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("Update for {} was attempted, although the "
- + "connector only has these capabilities: {}. No action.", uid.getUidValue(), activeConnInstance.
+ + "connector only has these capabilities: {}. No action.", uid.getUidValue(), connInstance.
getCapabilities());
}
@@ -242,13 +240,13 @@ public class ConnectorFacadeProxy implements Connector {
final OperationOptions options,
final Boolean[] propagationAttempted) {
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.DELETE)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.DELETE)) {
propagationAttempted[0] = true;
Future<Uid> future = asyncFacade.delete(connector, objectClass, uid, options);
try {
- future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -262,7 +260,7 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("Delete for {} was attempted, although the connector only has these capabilities: {}. No action.",
- uid.getUidValue(), activeConnInstance.getCapabilities());
+ uid.getUidValue(), connInstance.getCapabilities());
}
}
@@ -270,11 +268,11 @@ public class ConnectorFacadeProxy implements Connector {
public void sync(final ObjectClass objectClass, final SyncToken token, final SyncResultsHandler handler,
final OperationOptions options) {
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.SYNC)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.SYNC)) {
connector.sync(objectClass, token, handler, options);
} else {
LOG.info("Sync was attempted, although the connector only has these capabilities: {}. No action.",
- activeConnInstance.getCapabilities());
+ connInstance.getCapabilities());
}
}
@@ -282,11 +280,11 @@ public class ConnectorFacadeProxy implements Connector {
public SyncToken getLatestSyncToken(final ObjectClass objectClass) {
SyncToken result = null;
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.SYNC)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.SYNC)) {
Future<SyncToken> future = asyncFacade.getLatestSyncToken(connector, objectClass);
try {
- result = future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -300,7 +298,7 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("getLatestSyncToken was attempted, although the "
- + "connector only has these capabilities: {}. No action.", activeConnInstance.getCapabilities());
+ + "connector only has these capabilities: {}. No action.", connInstance.getCapabilities());
}
return result;
@@ -320,17 +318,17 @@ public class ConnectorFacadeProxy implements Connector {
boolean hasCapablities = false;
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.SEARCH)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.SEARCH)) {
if (operationType == null) {
hasCapablities = true;
} else {
switch (operationType) {
case CREATE:
- hasCapablities = activeConnInstance.getCapabilities().contains(ConnectorCapability.CREATE);
+ hasCapablities = connInstance.getCapabilities().contains(ConnectorCapability.CREATE);
break;
case UPDATE:
- hasCapablities = activeConnInstance.getCapabilities().contains(ConnectorCapability.UPDATE);
+ hasCapablities = connInstance.getCapabilities().contains(ConnectorCapability.UPDATE);
break;
default:
@@ -344,11 +342,11 @@ public class ConnectorFacadeProxy implements Connector {
future = asyncFacade.getObject(connector, objectClass, uid, options);
} else {
LOG.info("Search was attempted, although the connector only has these capabilities: {}. No action.",
- activeConnInstance.getCapabilities());
+ connInstance.getCapabilities());
}
try {
- return future == null ? null : future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ return future == null ? null : future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
if (future != null) {
future.cancel(true);
@@ -383,69 +381,10 @@ public class ConnectorFacadeProxy implements Connector {
}
@Override
- public Attribute getObjectAttribute(final ObjectClass objectClass, final Uid uid, final OperationOptions options,
- final String attributeName) {
-
- Future<Attribute> future = asyncFacade.getObjectAttribute(
- connector, objectClass, uid, options, attributeName);
- try {
- return future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
- } catch (java.util.concurrent.TimeoutException e) {
- future.cancel(true);
- throw new TimeoutException("Request timeout");
- } catch (Exception e) {
- LOG.error("Connector request execution failure", e);
- if (e.getCause() instanceof RuntimeException) {
- throw (RuntimeException) e.getCause();
- } else {
- throw new IllegalArgumentException(e.getCause());
- }
- }
- }
-
- @Override
- public Set<Attribute> getObjectAttributes(final ObjectClass objectClass, final Uid uid,
- final OperationOptions options) {
-
- Future<Set<Attribute>> future = asyncFacade.getObjectAttributes(connector, objectClass, uid, options);
+ public Set<ObjectClassInfo> getObjectClassInfo() {
+ Future<Set<ObjectClassInfo>> future = asyncFacade.getObjectClassInfo(connector);
try {
- return future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
- } catch (java.util.concurrent.TimeoutException e) {
- future.cancel(true);
- throw new TimeoutException("Request timeout");
- } catch (Exception e) {
- LOG.error("Connector request execution failure", e);
- if (e.getCause() instanceof RuntimeException) {
- throw (RuntimeException) e.getCause();
- } else {
- throw new IllegalArgumentException(e.getCause());
- }
- }
- }
-
- @Override
- public Set<String> getSchemaNames(final boolean includeSpecial) {
- Future<Set<String>> future = asyncFacade.getSchemaNames(connector, includeSpecial);
- try {
- return future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
- } catch (java.util.concurrent.TimeoutException e) {
- future.cancel(true);
- throw new TimeoutException("Request timeout");
- } catch (Exception e) {
- LOG.error("Connector request execution failure", e);
- if (e.getCause() instanceof RuntimeException) {
- throw (RuntimeException) e.getCause();
- } else {
- throw new IllegalArgumentException(e.getCause());
- }
- }
- }
-
- @Override
- public Set<ObjectClass> getSupportedObjectClasses() {
- Future<Set<ObjectClass>> future = asyncFacade.getSupportedObjectClasses(connector);
- try {
- return future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ return future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -463,7 +402,7 @@ public class ConnectorFacadeProxy implements Connector {
public void validate() {
Future<String> future = asyncFacade.test(connector);
try {
- future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -481,7 +420,7 @@ public class ConnectorFacadeProxy implements Connector {
public void test() {
Future<String> future = asyncFacade.test(connector);
try {
- future.get(activeConnInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
+ future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
future.cancel(true);
throw new TimeoutException("Request timeout");
@@ -502,7 +441,7 @@ public class ConnectorFacadeProxy implements Connector {
final ResultsHandler handler,
final OperationOptions options) {
- if (activeConnInstance.getCapabilities().contains(ConnectorCapability.SEARCH)) {
+ if (connInstance.getCapabilities().contains(ConnectorCapability.SEARCH)) {
if (options.getPageSize() == null && options.getPagedResultsCookie() == null) {
OperationOptionsBuilder builder = new OperationOptionsBuilder(options);
builder.setPageSize(DEFAULT_PAGE_SIZE);
@@ -534,7 +473,7 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("Search was attempted, although the connector only has these capabilities: {}. No action.",
- activeConnInstance.getCapabilities());
+ connInstance.getCapabilities());
}
}
@@ -560,39 +499,14 @@ public class ConnectorFacadeProxy implements Connector {
}
}, new ArrayList<SortKey>(orderBy.size())));
- builder.setAttributesToGet(getOperationOptions(mapItems).getAttributesToGet());
+ builder.setAttributesToGet(MappingUtils.buildOperationOptions(mapItems).getAttributesToGet());
search(objectClass, filter, handler, builder.build());
}
@Override
- public ConnInstance getActiveConnInstance() {
- return activeConnInstance;
- }
-
- @Override
- public OperationOptions getOperationOptions(final Iterator<? extends MappingItem> mapItems) {
- // -------------------------------------
- // Ask just for mapped attributes
- // -------------------------------------
- OperationOptionsBuilder builder = new OperationOptionsBuilder();
-
- Set<String> attrsToGet = new HashSet<>();
- attrsToGet.add(Name.NAME);
- attrsToGet.add(Uid.NAME);
- attrsToGet.add(OperationalAttributes.ENABLE_NAME);
-
- while (mapItems.hasNext()) {
- MappingItem mapItem = mapItems.next();
- if (mapItem.getPurpose() != MappingPurpose.NONE) {
- attrsToGet.add(mapItem.getExtAttrName());
- }
- }
-
- builder.setAttributesToGet(attrsToGet);
- // -------------------------------------
-
- return builder.build();
+ public ConnInstance getConnInstance() {
+ return connInstance;
}
private Object getPropertyValue(final String propType, final List<?> values) {
@@ -637,6 +551,6 @@ public class ConnectorFacadeProxy implements Connector {
@Override
public String toString() {
return "ConnectorFacadeProxy{"
- + "connector=" + connector + "\n" + "capabitilies=" + activeConnInstance.getCapabilities() + '}';
+ + "connector=" + connector + "\n" + "capabitilies=" + connInstance.getCapabilities() + '}';
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorManager.java
index a38ba50..1ecc163 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorManager.java
@@ -25,8 +25,10 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.core.misc.security.AuthContextUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.SyncopeLoader;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
@@ -42,11 +44,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-/**
- * Load ConnId connector instances.
- */
@Component
-public class ConnectorManager implements ConnectorRegistry, ConnectorFactory {
+public class ConnectorManager implements ConnectorRegistry, ConnectorFactory, SyncopeLoader {
private static final Logger LOG = LoggerFactory.getLogger(ConnectorManager.class);
@@ -56,6 +55,11 @@ public class ConnectorManager implements ConnectorRegistry, ConnectorFactory {
@Autowired
private ExternalResourceDAO resourceDAO;
+ @Override
+ public Integer getPriority() {
+ return 100;
+ }
+
private String getBeanName(final ExternalResource resource) {
return String.format("connInstance-%s-%d-%s",
AuthContextUtils.getDomain(), resource.getConnector().getKey(), resource.getKey());
@@ -72,54 +76,61 @@ public class ConnectorManager implements ConnectorRegistry, ConnectorFactory {
}
@Override
- public Connector createConnector(final ConnInstance connInstance, final Set<ConnConfProperty> configuration) {
- ConnInstance connInstanceClone = SerializationUtils.clone(connInstance);
-
- connInstanceClone.setConfiguration(configuration);
+ public ConnInstance buildConnInstanceOverride(
+ final ConnInstance connInstance,
+ final Set<ConnConfProperty> confOverride,
+ final Set<ConnectorCapability> capabilitiesOverride) {
- Connector connector = new ConnectorFacadeProxy(connInstanceClone);
- ApplicationContextProvider.getBeanFactory().autowireBean(connector);
-
- return connector;
- }
-
- @Override
- public ConnInstance getOverriddenConnInstance(
- final ConnInstance connInstance, final Set<ConnConfProperty> overridden) {
+ ConnInstance override = SerializationUtils.clone(connInstance);
- Set<ConnConfProperty> configuration = new HashSet<>();
Map<String, ConnConfProperty> overridable = new HashMap<>();
+ Set<ConnConfProperty> conf = new HashSet<>();
- // add not overridable properties
- for (ConnConfProperty prop : connInstance.getConfiguration()) {
+ for (ConnConfProperty prop : override.getConf()) {
if (prop.isOverridable()) {
overridable.put(prop.getSchema().getName(), prop);
} else {
- configuration.add(prop);
+ conf.add(prop);
}
}
// add overridden properties
- for (ConnConfProperty prop : overridden) {
+ for (ConnConfProperty prop : confOverride) {
if (overridable.containsKey(prop.getSchema().getName()) && !prop.getValues().isEmpty()) {
- configuration.add(prop);
+ conf.add(prop);
overridable.remove(prop.getSchema().getName());
}
}
// add overridable properties not overridden
- configuration.addAll(overridable.values());
+ conf.addAll(overridable.values());
- connInstance.setConfiguration(configuration);
+ override.setConf(conf);
- return connInstance;
+ // replace capabilities
+ if (capabilitiesOverride != null) {
+ override.getCapabilities().clear();
+ override.getCapabilities().addAll(capabilitiesOverride);
+ }
+
+ return override;
+ }
+
+ @Override
+ public Connector createConnector(final ConnInstance connInstance) {
+ Connector connector = new ConnectorFacadeProxy(connInstance);
+ ApplicationContextProvider.getBeanFactory().autowireBean(connector);
+
+ return connector;
}
@Override
public void registerConnector(final ExternalResource resource) {
- ConnInstance connInstance = getOverriddenConnInstance(
- SerializationUtils.clone(resource.getConnector()), resource.getConnInstanceConfiguration());
- Connector connector = createConnector(resource.getConnector(), connInstance.getConfiguration());
+ ConnInstance connInstance = buildConnInstanceOverride(
+ resource.getConnector(),
+ resource.getConfOverride(),
+ resource.isOverrideCapabilities() ? resource.getCapabilitiesOverride() : null);
+ Connector connector = createConnector(connInstance);
LOG.debug("Connector to be registered: {}", connector);
String beanName = getBeanName(resource);
@@ -137,11 +148,6 @@ public class ConnectorManager implements ConnectorRegistry, ConnectorFactory {
ApplicationContextProvider.getBeanFactory().destroySingleton(id);
}
- @Override
- public Integer getPriority() {
- return 100;
- }
-
@Transactional(readOnly = true)
@Override
public void load() {
@@ -171,7 +177,7 @@ public class ConnectorManager implements ConnectorRegistry, ConnectorFactory {
public void unload() {
int connectors = 0;
for (ExternalResource resource : resourceDAO.findAll()) {
- final String beanName = getBeanName(resource);
+ String beanName = getBeanName(resource);
if (ApplicationContextProvider.getBeanFactory().containsSingleton(beanName)) {
LOG.info("Unegistering resource-connector pair {}-{}", resource, resource.getConnector());
unregisterConnector(beanName);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
index 5763449..94c68ee 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
@@ -130,7 +130,7 @@ public class VirAttrHandlerImpl implements VirAttrHandler {
ConnectorObject connectorObject = connector.getObject(
entry.getKey().getObjectClass(),
new Uid(connObjectKey),
- connector.getOperationOptions(linkingMappingItems.iterator()));
+ MappingUtils.buildOperationOptions(linkingMappingItems.iterator()));
if (connectorObject == null) {
LOG.debug("No read from {} about {}", entry.getKey(), connObjectKey);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
index 7c28b66..70914ae 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
@@ -21,8 +21,6 @@ package org.apache.syncope.core.provisioning.java.data;
import org.apache.syncope.core.provisioning.api.data.ConnInstanceDataBinder;
import java.util.Arrays;
import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -58,35 +56,6 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
private EntityFactory entityFactory;
@Override
- public Set<ConnConfProperty> mergeConnConfProperties(
- final Set<ConnConfProperty> primary,
- final Set<ConnConfProperty> secondary) {
-
- Set<ConnConfProperty> conf = new HashSet<>();
-
- // to be used to control managed prop (needed by overridden mechanism)
- Set<String> propertyNames = new HashSet<>();
-
- // get overridden connector configuration properties
- for (ConnConfProperty prop : primary) {
- if (!propertyNames.contains(prop.getSchema().getName())) {
- conf.add(prop);
- propertyNames.add(prop.getSchema().getName());
- }
- }
-
- // get connector configuration properties
- for (ConnConfProperty prop : secondary) {
- if (!propertyNames.contains(prop.getSchema().getName())) {
- conf.add(prop);
- propertyNames.add(prop.getSchema().getName());
- }
- }
-
- return conf;
- }
-
- @Override
public ConnInstance getConnInstance(final ConnInstanceTO connInstanceTO) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
@@ -106,7 +75,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
sce.getElements().add("connectorname");
}
- if (connInstanceTO.getConfiguration() == null || connInstanceTO.getConfiguration().isEmpty()) {
+ if (connInstanceTO.getConf().isEmpty()) {
sce.getElements().add("configuration");
}
@@ -130,7 +99,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
}
@Override
- public ConnInstance updateConnInstance(final long connInstanceId, final ConnInstanceTO connInstanceTO) {
+ public ConnInstance update(final long connInstanceId, final ConnInstanceTO connInstanceTO) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
if (connInstanceId == 0) {
@@ -157,8 +126,8 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
connInstance.setConnectorName(connInstanceTO.getConnectorName());
}
- if (connInstanceTO.getConfiguration() != null && !connInstanceTO.getConfiguration().isEmpty()) {
- connInstance.setConfiguration(connInstanceTO.getConfiguration());
+ if (connInstanceTO.getConf() != null && !connInstanceTO.getConf().isEmpty()) {
+ connInstance.setConf(connInstanceTO.getConf());
}
if (connInstanceTO.getDisplayName() != null) {
@@ -184,7 +153,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
}
@Override
- public ConnConfPropSchema buildConnConfPropSchema(final ConfigurationProperty property) {
+ public ConnConfPropSchema build(final ConfigurationProperty property) {
ConnConfPropSchema connConfPropSchema = new ConnConfPropSchema();
connConfPropSchema.setName(property.getName());
@@ -219,9 +188,9 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
ConfigurationProperties properties =
connIdBundleManager.getConfigurationProperties(connIdBundleManager.getConnectorInfo(connInstance));
for (final String propName : properties.getPropertyNames()) {
- ConnConfPropSchema schema = buildConnConfPropSchema(properties.getProperty(propName));
+ ConnConfPropSchema schema = build(properties.getProperty(propName));
- ConnConfProperty property = CollectionUtils.find(connInstanceTO.getConfiguration(),
+ ConnConfProperty property = CollectionUtils.find(connInstanceTO.getConf(),
new Predicate<ConnConfProperty>() {
@Override
@@ -231,7 +200,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
});
if (property == null) {
property = new ConnConfProperty();
- connInstanceTO.getConfiguration().add(property);
+ connInstanceTO.getConf().add(property);
}
property.setSchema(schema);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index 388f099..dff71a0 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -33,7 +33,6 @@ import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
@@ -43,7 +42,6 @@ import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.SyncPolicy;
-import org.apache.syncope.core.provisioning.api.ConnectorRegistry;
import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,9 +66,6 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
private AnyTypeDAO anyTypeDAO;
@Autowired
- private ConnectorRegistry connRegistry;
-
- @Autowired
private ConnInstanceDAO connInstanceDAO;
@Autowired
@@ -100,7 +95,7 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resource.setConnector(connector);
if (!connector.getResources().contains(resource)) {
- connector.addResource(resource);
+ connector.add(resource);
}
}
@@ -196,7 +191,11 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resource.setSyncPolicy(resourceTO.getSyncPolicy() == null
? null : (SyncPolicy) policyDAO.find(resourceTO.getSyncPolicy()));
- resource.setConnInstanceConfiguration(new HashSet<>(resourceTO.getConnConfProperties()));
+ resource.setConfOverride(new HashSet<>(resourceTO.getConfOverride()));
+
+ resource.setOverrideCapabilities(resourceTO.isOverrideCapabilities());
+ resource.getCapabilitiesOverride().clear();
+ resource.getCapabilitiesOverride().addAll(resourceTO.getCapabilitiesOverride());
resource.getPropagationActionsClassNames().clear();
resource.getPropagationActionsClassNames().addAll(resourceTO.getPropagationActionsClassNames());
@@ -270,17 +269,6 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
return item;
}
- @Override
- public ConnInstance getConnInstance(final ResourceTO resourceTO) {
- ConnInstance connInstance = connInstanceDAO.find(resourceTO.getConnector());
- if (connInstance == null) {
- throw new NotFoundException("Connector '" + resourceTO.getConnector() + "'");
- }
-
- final ConnInstance connInstanceClone = SerializationUtils.clone(connInstance);
- return connRegistry.getOverriddenConnInstance(connInstanceClone, resourceTO.getConnConfProperties());
- }
-
private void populateMappingTO(final Mapping mapping, final MappingTO mappingTO) {
mappingTO.setConnObjectLink(mapping.getConnObjectLink());
@@ -367,7 +355,10 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resourceTO.setSyncPolicy(resource.getSyncPolicy() == null
? null : resource.getSyncPolicy().getKey());
- resourceTO.getConnConfProperties().addAll(resource.getConnInstanceConfiguration());
+ resourceTO.getConfOverride().addAll(resource.getConfOverride());
+
+ resourceTO.setOverrideCapabilities(resource.isOverrideCapabilities());
+ resourceTO.getCapabilitiesOverride().addAll(resource.getCapabilitiesOverride());
resourceTO.getPropagationActionsClassNames().addAll(resource.getPropagationActionsClassNames());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
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 316f91a..c083187 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
@@ -566,7 +566,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
task.getOperation(),
new ObjectClass(task.getObjectClassName()),
new Uid(connObjectKey),
- connector.getOperationOptions(IteratorUtils.chainedIterator(
+ MappingUtils.buildOperationOptions(IteratorUtils.chainedIterator(
MappingUtils.getPropagationMappingItems(provision).iterator(),
linkingMappingItems.iterator())));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
index 6b4760b..6910c19 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DBPasswordPropagationActions.java
@@ -88,7 +88,7 @@ public class DBPasswordPropagationActions extends DefaultPropagationActions {
private String getCipherAlgorithm(final ConnInstance connInstance) {
ConnConfProperty cipherAlgorithm =
- CollectionUtils.find(connInstance.getConfiguration(), new Predicate<ConnConfProperty>() {
+ CollectionUtils.find(connInstance.getConf(), new Predicate<ConnConfProperty>() {
@Override
public boolean evaluate(final ConnConfProperty property) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
index 870be79..3ba0dc9 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/LDAPPasswordPropagationActions.java
@@ -94,7 +94,7 @@ public class LDAPPasswordPropagationActions extends DefaultPropagationActions {
private String getCipherAlgorithm(final ConnInstance connInstance) {
ConnConfProperty cipherAlgorithm =
- CollectionUtils.find(connInstance.getConfiguration(), new Predicate<ConnConfProperty>() {
+ CollectionUtils.find(connInstance.getConf(), new Predicate<ConnConfProperty>() {
@Override
public boolean evaluate(final ConnConfProperty property) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
index dcce5e5..e0d3d59 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
@@ -134,7 +134,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
obj = profile.getConnector().getObject(
objectClass,
uid,
- profile.getConnector().getOperationOptions(IteratorUtils.<MappingItem>emptyIterator()));
+ MappingUtils.buildOperationOptions(IteratorUtils.<MappingItem>emptyIterator()));
} catch (TimeoutException toe) {
LOG.debug("Request timeout", toe);
throw toe;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
index ec7fb2e..35e50f9 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
@@ -91,7 +91,7 @@ public class DBPasswordSyncActions extends DefaultSyncActions {
private void parseEncodedPassword(final String password, final Connector connector) {
if (password != null) {
- ConnInstance connInstance = connector.getActiveConnInstance();
+ ConnInstance connInstance = connector.getConnInstance();
String cipherAlgorithm = getCipherAlgorithm(connInstance);
if (!CLEARTEXT.equals(cipherAlgorithm)) {
@@ -108,7 +108,7 @@ public class DBPasswordSyncActions extends DefaultSyncActions {
private String getCipherAlgorithm(final ConnInstance connInstance) {
ConnConfProperty cipherAlgorithm =
- CollectionUtils.find(connInstance.getConfiguration(), new Predicate<ConnConfProperty>() {
+ CollectionUtils.find(connInstance.getConf(), new Predicate<ConnConfProperty>() {
@Override
public boolean evaluate(final ConnConfProperty property) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
index 430d06d..59e8c42 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
@@ -55,6 +55,7 @@ import org.apache.syncope.core.persistence.api.entity.user.UMembership;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -109,7 +110,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
* @return the name of the attribute used to keep track of group memberships
*/
protected String getGroupMembershipAttrName(final Connector connector) {
- ConnConfProperty groupMembership = CollectionUtils.find(connector.getActiveConnInstance().getConfiguration(),
+ ConnConfProperty groupMembership = CollectionUtils.find(connector.getConnInstance().getConf(),
new Predicate<ConnConfProperty>() {
@Override
@@ -196,7 +197,12 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
if (membAttr == null) {
OperationOptionsBuilder oob = new OperationOptionsBuilder();
oob.setAttributesToGet(groupMemberName);
- membAttr = connector.getObjectAttribute(ObjectClass.GROUP, delta.getUid(), oob.build(), groupMemberName);
+ ConnectorObject remoteObj = connector.getObject(ObjectClass.GROUP, delta.getUid(), oob.build());
+ if (remoteObj == null) {
+ LOG.debug("Object for '{}' not found", delta.getUid().getUidValue());
+ } else {
+ membAttr = remoteObj.getAttributeByName(groupMemberName);
+ }
}
if (membAttr != null && membAttr.getValue() != null) {
result = membAttr.getValue();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
index 890cece..d3a4a4d 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
@@ -27,6 +27,7 @@ import java.util.Set;
import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.policy.SyncPolicySpec;
+import org.apache.syncope.core.misc.MappingUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -185,13 +186,13 @@ public class SyncJobDelegate extends AbstractProvisioningJobDelegate<SyncTask> {
connector.getAllObjects(
provision.getObjectClass(),
handler,
- connector.getOperationOptions(mapItems));
+ MappingUtils.buildOperationOptions(mapItems));
} else {
connector.sync(
provision.getObjectClass(),
provision.getSyncToken(),
handler,
- connector.getOperationOptions(mapItems));
+ MappingUtils.buildOperationOptions(mapItems));
}
if (!dryRun && !syncTask.isFullReconciliation()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
index eefccad..4fa504e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncUtils.java
@@ -128,7 +128,7 @@ public class SyncUtils {
return found.add(obj);
}
},
- connector.getOperationOptions(MappingUtils.getSyncMappingItems(provision).iterator()));
+ MappingUtils.buildOperationOptions(MappingUtils.getSyncMappingItems(provision).iterator()));
if (found.isEmpty()) {
LOG.debug("No {} found on {} with __NAME__ {}", provision.getObjectClass(), resource, name);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
index ac0694d..c64a02d 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
@@ -24,10 +24,8 @@ import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.wrap.ConnIdObjectClass;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.ConnectorService;
import org.apache.syncope.core.logic.ConnectorLogic;
@@ -60,13 +58,10 @@ public class ConnectorServiceImpl extends AbstractServiceImpl implements Connect
}
@Override
- public List<PlainSchemaTO> buildSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
- return logic.buildSchemaNames(connInstanceTO, includeSpecial);
- }
+ public List<ConnIdObjectClassTO> buildObjectClassInfo(
+ final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
- @Override
- public List<ConnIdObjectClass> buildSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
- return CollectionWrapper.wrap(logic.buildSupportedObjectClasses(connInstanceTO), ConnIdObjectClass.class);
+ return logic.buildObjectClassInfo(connInstanceTO, includeSpecial);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
index 32ae12c..b8a9fa7 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
@@ -25,7 +25,7 @@ import org.apache.syncope.common.lib.to.EventCategoryTO;
import org.apache.syncope.common.lib.to.LoggerTO;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
+import org.apache.syncope.common.rest.api.LoggerWrapper;
import org.apache.syncope.common.rest.api.service.LoggerService;
import org.apache.syncope.core.logic.LoggerLogic;
import org.springframework.beans.factory.annotation.Autowired;
@@ -66,7 +66,7 @@ public class LoggerServiceImpl extends AbstractServiceImpl implements LoggerServ
case AUDIT:
List<AuditLoggerName> auditLogger = logic.listAudits();
- return CollectionWrapper.unwrapLogger(auditLogger);
+ return LoggerWrapper.unwrap(auditLogger);
default:
throw new BadRequestException();
[13/50] [abbrv] syncope git commit: Fixed SYNCOPE-580,
refactoring and added realm stack, SYNCOPE-158
Posted by fm...@apache.org.
Fixed SYNCOPE-580, refactoring and added realm stack, SYNCOPE-158
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/47b9f64b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/47b9f64b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/47b9f64b
Branch: refs/heads/SYNCOPE-156
Commit: 47b9f64bd1aeb9ec9260f809a83c042cbf09b9fd
Parents: 7866cdb
Author: massi <ma...@tirasa.net>
Authored: Tue Oct 27 18:07:06 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Tue Oct 27 18:07:24 2015 +0100
----------------------------------------------------------------------
.../org/apache/syncope/client/cli/Input.java | 6 +
.../cli/commands/CommonsResultManager.java | 2 +-
.../AbstractConfigurationCommand.java | 6 +-
.../configuration/ConfigurationDelete.java | 2 +-
.../configuration/ConfigurationExport.java | 2 +-
.../configuration/ConfigurationGet.java | 2 +-
.../configuration/ConfigurationRead.java | 2 +-
.../ConfigurationSyncopeOperations.java | 50 +++++++
.../configuration/ConfigurationUpdate.java | 4 +-
.../connector/AbstractConnectorCommand.java | 5 +-
.../cli/commands/connector/ConnectorDelete.java | 4 +-
.../cli/commands/connector/ConnectorList.java | 2 +-
.../connector/ConnectorListBundles.java | 2 +-
.../ConnectorListConfigurationProperties.java | 4 +-
.../cli/commands/connector/ConnectorRead.java | 4 +-
.../connector/ConnectorReadByResource.java | 2 +-
.../connector/ConnectorSyncopeOperations.java | 50 +++++++
.../commands/domain/AbstractDomainCommand.java | 5 +-
.../cli/commands/domain/DomainDelete.java | 2 +-
.../client/cli/commands/domain/DomainList.java | 2 +-
.../client/cli/commands/domain/DomainRead.java | 4 +-
.../domain/DomainSyncopeOperations.java | 41 ++++++
.../cli/commands/install/InstallSetup.java | 3 +-
.../commands/logger/AbstractLoggerCommand.java | 7 +-
.../cli/commands/logger/LoggerCreate.java | 3 +-
.../cli/commands/logger/LoggerDelete.java | 3 +-
.../client/cli/commands/logger/LoggerList.java | 3 +-
.../client/cli/commands/logger/LoggerRead.java | 3 +-
.../logger/LoggerSyncopeOperations.java | 46 ++++++
.../cli/commands/logger/LoggerUpdate.java | 5 +-
.../cli/commands/logger/LoggerUpdateAll.java | 5 +-
.../AbstractNotificationCommand.java | 5 +-
.../notification/NotificationDelete.java | 2 +-
.../commands/notification/NotificationList.java | 2 +-
.../commands/notification/NotificationRead.java | 2 +-
.../NotificationSyncopeOperations.java | 41 ++++++
.../commands/policy/AbstractPolicyCommand.java | 7 +-
.../cli/commands/policy/PolicyDelete.java | 2 +-
.../client/cli/commands/policy/PolicyList.java | 2 +-
.../client/cli/commands/policy/PolicyRead.java | 2 +-
.../policy/PolicySyncopeOperations.java | 42 ++++++
.../commands/realm/AbstractRealmCommand.java | 27 ++++
.../client/cli/commands/realm/RealmCommand.java | 96 +++++++++++++
.../client/cli/commands/realm/RealmList.java | 36 +++++
.../cli/commands/realm/RealmResultManager.java | 39 +++++
.../commands/realm/RealmSyncopeOperations.java | 44 ++++++
.../commands/report/AbstractReportCommand.java | 5 +-
.../cli/commands/report/ReportDelete.java | 4 +-
.../commands/report/ReportDeleteExecution.java | 4 +-
.../cli/commands/report/ReportExecute.java | 7 +-
.../commands/report/ReportExportExecution.java | 10 +-
.../client/cli/commands/report/ReportList.java | 2 +-
.../cli/commands/report/ReportListJobs.java | 2 +-
.../client/cli/commands/report/ReportRead.java | 4 +-
.../commands/report/ReportReadExecution.java | 4 +-
.../report/ReportSyncopeOperations.java | 65 +++++++++
.../resource/AbstractResourceCommand.java | 7 +-
.../cli/commands/resource/ResourceDelete.java | 4 +-
.../cli/commands/resource/ResourceList.java | 2 +-
.../cli/commands/resource/ResourceRead.java | 4 +-
.../resource/ResourceResultManager.java | 5 +-
.../resource/ResourceSyncopeOperations.java | 51 +++++++
.../commands/schema/AbstractSchemaCommand.java | 7 +-
.../cli/commands/schema/SchemaDelete.java | 2 +-
.../client/cli/commands/schema/SchemaList.java | 2 +-
.../cli/commands/schema/SchemaListAll.java | 2 +-
.../cli/commands/schema/SchemaListDerived.java | 3 +-
.../cli/commands/schema/SchemaListPlain.java | 3 +-
.../cli/commands/schema/SchemaListVirtual.java | 3 +-
.../client/cli/commands/schema/SchemaRead.java | 2 +-
.../schema/SchemaSyncopeOperations.java | 54 +++++++
.../cli/commands/task/AbstractTaskCommand.java | 5 +-
.../client/cli/commands/task/TaskDelete.java | 2 +-
.../client/cli/commands/task/TaskExecute.java | 4 +-
.../cli/commands/task/TaskExecutionDelete.java | 2 +-
.../cli/commands/task/TaskExecutionRead.java | 2 +-
.../client/cli/commands/task/TaskList.java | 2 +-
.../client/cli/commands/task/TaskRead.java | 2 +-
.../cli/commands/task/TaskRunningJobs.java | 3 +-
.../cli/commands/task/TaskScheduledJobs.java | 3 +-
.../commands/task/TaskSyncopeOperations.java | 66 +++++++++
.../cli/commands/user/AbstractUserCommand.java | 27 ++++
.../client/cli/commands/user/UserCommand.java | 144 +++++++++++++++++++
.../client/cli/commands/user/UserCount.java | 43 ++++++
.../client/cli/commands/user/UserDelete.java | 55 +++++++
.../client/cli/commands/user/UserGetKey.java | 45 ++++++
.../cli/commands/user/UserGetUsername.java | 45 ++++++
.../client/cli/commands/user/UserList.java | 48 +++++++
.../client/cli/commands/user/UserRead.java | 60 ++++++++
.../cli/commands/user/UserResultManager.java | 110 ++++++++++++++
.../commands/user/UserSearchByAttribute.java | 69 +++++++++
.../cli/commands/user/UserSearchByResource.java | 68 +++++++++
.../cli/commands/user/UserSearchByRole.java | 62 ++++++++
.../commands/user/UserSyncopeOperations.java | 78 ++++++++++
94 files changed, 1697 insertions(+), 136 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
index 9314187..63d7952 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
@@ -18,6 +18,8 @@
*/
package org.apache.syncope.client.cli;
+import java.util.Arrays;
+import java.util.List;
import org.apache.syncope.client.cli.commands.AbstractCommand;
import org.apache.syncope.client.cli.util.CommandUtils;
@@ -63,6 +65,10 @@ public class Input {
public String[] getParameters() {
return parameters;
}
+
+ public List<String> listParameters() {
+ return Arrays.asList(parameters);
+ }
public String firstParameter() {
return parameters[0];
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
index 251297b..39c32e6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
@@ -24,7 +24,7 @@ import org.apache.syncope.common.lib.types.ConnConfProperty;
public abstract class CommonsResultManager {
- public void managerNumberFormatException(final String what, final String key) {
+ public void numberFormatException(final String what, final String key) {
Messages.printIdNotNumberDeletedMessage(what, key);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
index 2942c07..87f0b00 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
@@ -18,12 +18,10 @@
*/
package org.apache.syncope.client.cli.commands.configuration;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ConfigurationService;
-
public abstract class AbstractConfigurationCommand {
- protected final ConfigurationService configurationService = SyncopeServices.get(ConfigurationService.class);
+ protected final ConfigurationSyncopeOperations configurationSyncopeOperations
+ = new ConfigurationSyncopeOperations();
protected final ConfigurationResultManager configurationResultManager = new ConfigurationResultManager();
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
index f308aa9..870cb27 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
@@ -36,7 +36,7 @@ public class ConfigurationDelete extends AbstractConfigurationCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- configurationService.delete(parameter);
+ configurationSyncopeOperations.delete(parameter);
configurationResultManager.deletedMessage("Configuration", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
index 2e61c4f..d08677a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
@@ -45,7 +45,7 @@ public class ConfigurationExport extends AbstractConfigurationCommand {
if (input.parameterNumber() == 1) {
try {
XMLUtils.createXMLFile(
- (SequenceInputStream) configurationService.export().getEntity(),
+ (SequenceInputStream) configurationSyncopeOperations.export().getEntity(),
input.firstParameter() + EXPORT_FILE_NAME);
configurationResultManager.generic(
input.firstParameter() + EXPORT_FILE_NAME + " successfully created");
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
index 2aa3ff4..3cad82d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
@@ -27,7 +27,7 @@ public class ConfigurationGet extends AbstractConfigurationCommand {
public void get() {
try {
- configurationResultManager.fromGet(new LinkedList<>(configurationService.list()));
+ configurationResultManager.fromGet(new LinkedList<>(configurationSyncopeOperations.list()));
} catch (final Exception ex) {
configurationResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
index c4294e7..5bccb3f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
@@ -40,7 +40,7 @@ public class ConfigurationRead extends AbstractConfigurationCommand {
boolean failed = false;
for (final String parameter : input.getParameters()) {
try {
- attrList.add(configurationService.get(parameter));
+ attrList.add(configurationSyncopeOperations.get(parameter));
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
configurationResultManager.notFoundError("Configuration", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
new file mode 100644
index 0000000..8efc97c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
@@ -0,0 +1,50 @@
+/*
+ * 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.cli.commands.configuration;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.rest.api.service.ConfigurationService;
+
+public class ConfigurationSyncopeOperations {
+
+ private final ConfigurationService configurationService = SyncopeServices.get(ConfigurationService.class);
+
+ public AttrTO get(final String schema) {
+ return configurationService.get(schema);
+ }
+
+ public void set(final AttrTO attrTO) {
+ configurationService.set(attrTO);
+ }
+
+ public List<AttrTO> list() {
+ return configurationService.list();
+ }
+
+ public Response export() {
+ return configurationService.export();
+ }
+
+ public void delete(final String schema) {
+ configurationService.delete(schema);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
index 295ebd1..2f85ffa 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
@@ -44,10 +44,10 @@ public class ConfigurationUpdate extends AbstractConfigurationCommand {
for (final String parameter : input.getParameters()) {
try {
pairParameter = input.toPairParameter(parameter);
- attrTO = configurationService.get(pairParameter.getKey());
+ attrTO = configurationSyncopeOperations.get(pairParameter.getKey());
attrTO.getValues().clear();
attrTO.getValues().add(pairParameter.getValue());
- configurationService.set(attrTO);
+ configurationSyncopeOperations.set(attrTO);
attrList.add(attrTO);
} catch (final IllegalArgumentException ex) {
configurationResultManager.generic(ex.getMessage(), UPDATE_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
index 0605c46..6286ed4 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.connector;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ConnectorService;
-
public abstract class AbstractConnectorCommand {
- protected final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
+ protected final ConnectorSyncopeOperations connectorSyncopeOperations = new ConnectorSyncopeOperations();
protected final ConnectorResultManager connectorResultManager = new ConnectorResultManager();
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
index ab4c82e..6e26b9b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
@@ -40,10 +40,10 @@ public class ConnectorDelete extends AbstractConnectorCommand {
final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- connectorService.delete(Long.valueOf(parameter));
+ connectorSyncopeOperations.delete(parameter);
connectorResultManager.deletedMessage("connector", parameter);
} catch (final NumberFormatException ex) {
- connectorResultManager.managerNumberFormatException("connector", parameter);
+ connectorResultManager.numberFormatException("connector", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Connector", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
index 7b6a3c6..f063228 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
@@ -24,7 +24,7 @@ public class ConnectorList extends AbstractConnectorCommand {
public void list() {
try {
- connectorResultManager.toView(connectorService.list(null));
+ connectorResultManager.toView(connectorSyncopeOperations.list());
} catch (final SyncopeClientException ex) {
connectorResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
index 72a103d..d77cd83 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
@@ -24,7 +24,7 @@ public class ConnectorListBundles extends AbstractConnectorCommand {
public void list() {
try {
- connectorResultManager.fromListBundles(connectorService.getBundles(null));
+ connectorResultManager.fromListBundles(connectorSyncopeOperations.getBundles());
} catch (final SyncopeClientException ex) {
connectorResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
index 3e454d7..91a0021 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
@@ -38,9 +38,9 @@ public class ConnectorListConfigurationProperties extends AbstractConnectorComma
for (final String parameter : input.getParameters()) {
try {
connectorResultManager.fromConfigurationProperties(
- connectorService.read(Long.valueOf(parameter), null).getConf());
+ connectorSyncopeOperations.read(parameter).getConf());
} catch (final NumberFormatException ex) {
- connectorResultManager.managerNumberFormatException("connector", parameter);
+ connectorResultManager.numberFormatException("connector", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Connector", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
index 46cbe84..e2dca1e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
@@ -40,9 +40,9 @@ public class ConnectorRead extends AbstractConnectorCommand {
final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- connInstanceTOs.add(connectorService.read(Long.valueOf(parameter), READ_HELP_MESSAGE));
+ connInstanceTOs.add(connectorSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
- connectorResultManager.managerNumberFormatException("connector", parameter);
+ connectorResultManager.numberFormatException("connector", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Connector", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
index bd7797c..d062077 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
@@ -41,7 +41,7 @@ public class ConnectorReadByResource extends AbstractConnectorCommand {
final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- connInstanceTOs.add(connectorService.readByResource(parameter, READ_HELP_MESSAGE));
+ connInstanceTOs.add(connectorSyncopeOperations.readByResource(parameter));
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Resource", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
new file mode 100644
index 0000000..b496063
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
@@ -0,0 +1,50 @@
+/*
+ * 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.cli.commands.connector;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.rest.api.service.ConnectorService;
+
+public class ConnectorSyncopeOperations {
+
+ protected final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
+
+ public ConnInstanceTO readByResource(final String resourceName) {
+ return connectorService.readByResource(resourceName, null);
+ }
+
+ public ConnInstanceTO read(final String resourceId) {
+ return connectorService.read(Long.valueOf(resourceId), null);
+ }
+
+ public List<ConnBundleTO> getBundles() {
+ return connectorService.getBundles(null);
+ }
+
+ public List<ConnInstanceTO> list() {
+ return connectorService.list(null);
+ }
+
+ public void delete(final String resourceId) {
+ connectorService.delete(Long.valueOf(resourceId));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
index b5bfca5..902f55c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.domain;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.DomainService;
-
public abstract class AbstractDomainCommand {
- protected final DomainService domainService = SyncopeServices.get(DomainService.class);
+ protected final DomainSyncopeOperations domainSyncopeOperations = new DomainSyncopeOperations();
protected final DomainResultManager domainResultManager = new DomainResultManager();
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
index 1b0c235..f85d3c9 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
@@ -35,7 +35,7 @@ public class DomainDelete extends AbstractDomainCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- domainService.delete(parameter);
+ domainSyncopeOperations.delete(parameter);
domainResultManager.deletedMessage("Domain", parameter);
} catch (final SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
index 94329d2..6cf7b7d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
@@ -28,7 +28,7 @@ public class DomainList extends AbstractDomainCommand {
public void list() {
try {
- for (final DomainTO domainTO : domainService.list()) {
+ for (final DomainTO domainTO : domainSyncopeOperations.list()) {
domainResultManager.generic(domainTO.getKey());
}
} catch (final SyncopeClientException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
index a76711d..2eaa75a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.cli.commands.domain;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.DomainTO;
public class DomainRead extends AbstractDomainCommand {
@@ -36,8 +35,7 @@ public class DomainRead extends AbstractDomainCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- final DomainTO domainTO = domainService.read(parameter);
- domainResultManager.generic(domainTO.getKey());
+ domainResultManager.generic(domainSyncopeOperations.read(parameter).getKey());
} catch (final SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
domainResultManager.notFoundError("Domain", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
new file mode 100644
index 0000000..994c217
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cli.commands.domain;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.DomainTO;
+import org.apache.syncope.common.rest.api.service.DomainService;
+
+public class DomainSyncopeOperations {
+
+ private final DomainService domainService = SyncopeServices.get(DomainService.class);
+
+ public DomainTO read(final String domainName) {
+ return domainService.read(domainName);
+ }
+
+ public List<DomainTO> list() {
+ return domainService.list();
+ }
+
+ public void delete(final String domainName) {
+ domainService.delete(domainName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
index 10995b0..4d9a0ff 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
@@ -48,8 +48,6 @@ public class InstallSetup {
}
public void setup() {
- final Scanner scanIn = new Scanner(System.in);
-
System.out.println("");
System.out.println("###############################################");
System.out.println("# #");
@@ -67,6 +65,7 @@ public class InstallSetup {
System.out.println("- File system permission checked");
System.out.println("");
+ final Scanner scanIn = new Scanner(System.in);
System.out.println("Syncope server schema [http/https]:");
String syncopeServerSchemaFromSystemIn = scanIn.nextLine();
boolean schemaFounded = false;
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
index a8703a9..3e0978a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.client.cli.commands.logger;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.LoggerService;
-
public abstract class AbstractLoggerCommand {
- protected final LoggerService loggerService = SyncopeServices.get(LoggerService.class);
-
+ protected final LoggerSyncopeOperations loggerSyncopeOperations = new LoggerSyncopeOperations();
+
protected final LoggerResultManager loggerResultManager = new LoggerResultManager();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
index 6a51e95..40b5e1b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.LoggerTO;
import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
public class LoggerCreate extends AbstractLoggerCommand {
@@ -50,7 +49,7 @@ public class LoggerCreate extends AbstractLoggerCommand {
pairParameter = input.toPairParameter(parameter);
loggerTO.setKey(pairParameter.getKey());
loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
- loggerService.update(LoggerType.LOG, loggerTO);
+ loggerSyncopeOperations.update(loggerTO);
loggerTOs.add(loggerTO);
} catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
loggerResultManager.typeNotValidError(
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
index 5815b71..8bdb3ab 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.cli.commands.logger;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.LoggerType;
public class LoggerDelete extends AbstractLoggerCommand {
@@ -37,7 +36,7 @@ public class LoggerDelete extends AbstractLoggerCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- loggerService.delete(LoggerType.LOG, parameter);
+ loggerSyncopeOperations.delete(parameter);
loggerResultManager.deletedMessage("Logger", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
index d9d4f81..b64eef6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.cli.commands.logger;
import java.util.LinkedList;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.LoggerType;
public class LoggerList extends AbstractLoggerCommand {
@@ -29,7 +28,7 @@ public class LoggerList extends AbstractLoggerCommand {
public void list() {
try {
- loggerResultManager.fromList(new LinkedList<>(loggerService.list(LoggerType.LOG)));
+ loggerResultManager.fromList(new LinkedList<>(loggerSyncopeOperations.list()));
} catch (final SyncopeClientException ex) {
loggerResultManager.generic("Error: " + ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
index 6e2447d..1192252 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
@@ -23,7 +23,6 @@ import javax.xml.ws.WebServiceException;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.LoggerTO;
-import org.apache.syncope.common.lib.types.LoggerType;
public class LoggerRead extends AbstractLoggerCommand {
@@ -41,7 +40,7 @@ public class LoggerRead extends AbstractLoggerCommand {
boolean failed = false;
for (final String parameter : input.getParameters()) {
try {
- loggerTOs.add(loggerService.read(LoggerType.LOG, parameter));
+ loggerTOs.add(loggerSyncopeOperations.read(parameter));
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
loggerResultManager.notFoundError("Logger", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
new file mode 100644
index 0000000..14b7d18
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cli.commands.logger;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.LoggerTO;
+import org.apache.syncope.common.lib.types.LoggerType;
+import org.apache.syncope.common.rest.api.service.LoggerService;
+
+public class LoggerSyncopeOperations {
+
+ private final LoggerService loggerService = SyncopeServices.get(LoggerService.class);
+
+ public List<LoggerTO> list() {
+ return loggerService.list(LoggerType.LOG);
+ }
+
+ public void update(final LoggerTO loggerTO) {
+ loggerService.update(LoggerType.LOG, loggerTO);
+ }
+
+ public LoggerTO read(final String loggerName) {
+ return loggerService.read(LoggerType.LOG, loggerName);
+ }
+
+ public void delete(final String loggerName) {
+ loggerService.delete(LoggerType.LOG, loggerName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
index 03de917..9a45916 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.LoggerTO;
import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
public class LoggerUpdate extends AbstractLoggerCommand {
@@ -47,9 +46,9 @@ public class LoggerUpdate extends AbstractLoggerCommand {
for (final String parameter : input.getParameters()) {
try {
pairParameter = input.toPairParameter(parameter);
- loggerTO = loggerService.read(LoggerType.LOG, pairParameter.getKey());
+ loggerTO = loggerSyncopeOperations.read(pairParameter.getKey());
loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
- loggerService.update(LoggerType.LOG, loggerTO);
+ loggerSyncopeOperations.update(loggerTO);
loggerTOs.add(loggerTO);
} catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
index 55c2e60..83c8b9a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.LoggerTO;
import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
public class LoggerUpdateAll extends AbstractLoggerCommand {
@@ -41,10 +40,10 @@ public class LoggerUpdateAll extends AbstractLoggerCommand {
if (input.parameterNumber() == 1) {
final LinkedList<LoggerTO> loggerTOs = new LinkedList<>();
boolean failed = false;
- for (final LoggerTO loggerTO : loggerService.list(LoggerType.LOG)) {
+ for (final LoggerTO loggerTO : loggerSyncopeOperations.list()) {
try {
loggerTO.setLevel(LoggerLevel.valueOf(input.firstParameter()));
- loggerService.update(LoggerType.LOG, loggerTO);
+ loggerSyncopeOperations.update(loggerTO);
loggerTOs.add(loggerTO);
} catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
index 2b862ed..a21f2cd 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.notification;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-
public abstract class AbstractNotificationCommand {
- protected final NotificationService notificationService = SyncopeServices.get(NotificationService.class);
+ protected final NotificationSyncopeOperations notificationSyncopeOperations = new NotificationSyncopeOperations();
protected final NotificationResultManager notificationResultManager = new NotificationResultManager();
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
index 2e0e5cd..3b11a5a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
@@ -37,7 +37,7 @@ public class NotificationDelete extends AbstractNotificationCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- notificationService.delete(Long.valueOf(parameter));
+ notificationSyncopeOperations.delete(parameter);
notificationResultManager.deletedMessage("Notification", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
index ff9561c..3df5d64 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
@@ -25,7 +25,7 @@ public class NotificationList extends AbstractNotificationCommand {
public void list() {
try {
- for (final NotificationTO notificationTO : notificationService.list()) {
+ for (final NotificationTO notificationTO : notificationSyncopeOperations.list()) {
System.out.println(notificationTO);
}
} catch (final SyncopeClientException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
index 386700c..bd82663 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
@@ -36,7 +36,7 @@ public class NotificationRead extends AbstractNotificationCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- System.out.println(notificationService.read(Long.valueOf(parameter)));
+ System.out.println(notificationSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
notificationResultManager.notBooleanDeletedError("notification", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
new file mode 100644
index 0000000..cb11cb5
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cli.commands.notification;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.NotificationTO;
+import org.apache.syncope.common.rest.api.service.NotificationService;
+
+public class NotificationSyncopeOperations {
+
+ private final NotificationService notificationService = SyncopeServices.get(NotificationService.class);
+
+ public NotificationTO read(final String notificationId) {
+ return notificationService.read(Long.valueOf(notificationId));
+ }
+
+ public List<NotificationTO> list() {
+ return notificationService.list();
+ }
+
+ public void delete(final String notificationId) {
+ notificationService.delete(Long.valueOf(notificationId));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
index 0bab4e5..0c8a55f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.client.cli.commands.policy;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.PolicyService;
-
public abstract class AbstractPolicyCommand {
- protected final PolicyService policyService = SyncopeServices.get(PolicyService.class);
-
+ protected final PolicySyncopeOperations policySyncopeOperations = new PolicySyncopeOperations();
+
protected final PolicyResultManager policyResultManager = new PolicyResultManager();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
index 15ffa8d..8f9ede3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
@@ -36,7 +36,7 @@ public class PolicyDelete extends AbstractPolicyCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- policyService.delete(Long.valueOf(parameter));
+ policySyncopeOperations.delete(parameter);
policyResultManager.deletedMessage("Policy", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
System.out.println("Error:");
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
index c05acf7..4b672d6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
@@ -42,7 +42,7 @@ public class PolicyList extends AbstractPolicyCommand {
try {
final PolicyType policyType = PolicyType.valueOf(input.firstParameter());
final LinkedList<AbstractPolicyTO> policyTOs = new LinkedList<>();
- for (final AbstractPolicyTO policyTO : policyService.list(policyType)) {
+ for (final AbstractPolicyTO policyTO : policySyncopeOperations.list(policyType)) {
policyTOs.add(policyTO);
}
policyResultManager.fromList(policyType, policyTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
index f20d41e..25c9306 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
@@ -39,7 +39,7 @@ public class PolicyRead extends AbstractPolicyCommand {
final LinkedList<AbstractPolicyTO> policyTOs = new LinkedList<>();
for (final String parameter : input.getParameters()) {
try {
- policyTOs.add(policyService.read(Long.valueOf(parameter)));
+ policyTOs.add(policySyncopeOperations.read(parameter));
policyResultManager.fromRead(policyTOs);
} catch (final NumberFormatException ex) {
policyResultManager.notBooleanDeletedError("policy", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
new file mode 100644
index 0000000..7c478f8
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
@@ -0,0 +1,42 @@
+/*
+ * 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.cli.commands.policy;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.common.rest.api.service.PolicyService;
+
+public class PolicySyncopeOperations {
+
+ private final PolicyService policyService = SyncopeServices.get(PolicyService.class);
+
+ public <T extends AbstractPolicyTO> T read(final String policyId) {
+ return policyService.read(Long.valueOf(policyId));
+ }
+
+ public <T extends AbstractPolicyTO> List<T> list(final PolicyType policyType) {
+ return policyService.list(policyType);
+ }
+
+ public void delete(final String policyId) {
+ policyService.delete(Long.valueOf(policyId));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
new file mode 100644
index 0000000..06cd1ba
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
@@ -0,0 +1,27 @@
+/*
+ * 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.cli.commands.realm;
+
+public abstract class AbstractRealmCommand {
+
+ protected final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+
+ protected final RealmResultManager realmResultManager = new RealmResultManager();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
new file mode 100644
index 0000000..6a32562
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
@@ -0,0 +1,96 @@
+/*
+ * 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.cli.commands.realm;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "realm")
+public class RealmCommand extends AbstractCommand {
+
+ private static final String HELP_MESSAGE = "Usage: realm [options]\n"
+ + " Options:\n"
+ + " --help \n"
+ + " --list \n";
+
+ @Override
+ public void execute(final Input input) {
+ if (StringUtils.isBlank(input.getOption())) {
+ input.setOption(Options.HELP.getOptionName());
+ }
+ switch (Options.fromName(input.getOption())) {
+ case LIST:
+ new RealmList().list();
+ break;
+ case HELP:
+ System.out.println(HELP_MESSAGE);
+ break;
+ default:
+ new RealmResultManager().deletedMessage(input.getOption(), HELP_MESSAGE);
+ }
+ }
+
+ @Override
+ public String getHelpMessage() {
+ return HELP_MESSAGE;
+ }
+
+ private enum Options {
+
+ HELP("--help"),
+ LIST("--list");
+
+ private final String optionName;
+
+ Options(final String optionName) {
+ this.optionName = optionName;
+ }
+
+ public String getOptionName() {
+ return optionName;
+ }
+
+ public boolean equalsOptionName(final String otherName) {
+ return (otherName == null) ? false : optionName.equals(otherName);
+ }
+
+ public static Options fromName(final String name) {
+ Options optionToReturn = HELP;
+ for (final Options option : Options.values()) {
+ if (option.equalsOptionName(name)) {
+ optionToReturn = option;
+ }
+ }
+ return optionToReturn;
+ }
+
+ public static List<String> toList() {
+ final List<String> options = new ArrayList<>();
+ for (final Options value : values()) {
+ options.add(value.getOptionName());
+ }
+ return options;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
new file mode 100644
index 0000000..5d4b902
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
@@ -0,0 +1,36 @@
+/*
+ * 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.cli.commands.realm;
+
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class RealmList extends AbstractRealmCommand {
+
+ public RealmList() {
+ }
+
+ public void list() {
+ try {
+ realmResultManager.toView(realmSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ realmResultManager.generic("Error: " + ex.getMessage());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
new file mode 100644
index 0000000..bbb46d9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cli.commands.realm;
+
+import java.util.List;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.RealmTO;
+
+public class RealmResultManager extends CommonsResultManager {
+
+ public void toView(final List<RealmTO> realmTOs) {
+ for (final RealmTO realmTO : realmTOs) {
+ System.out.println(" > REALM ID: " + realmTO.getKey());
+ System.out.println(" name: " + realmTO.getName());
+ System.out.println(" full path: " + realmTO.getFullPath());
+ System.out.println(" actions: " + realmTO.getActionsClassNames());
+ System.out.println(" templates: " + realmTO.getTemplates());
+ System.out.println(" parent id: " + realmTO.getParent());
+ System.out.println(" account policy id: " + realmTO.getAccountPolicy());
+ System.out.println(" password policy id: " + realmTO.getPasswordPolicy());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
new file mode 100644
index 0000000..e9d0b65
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
@@ -0,0 +1,44 @@
+/*
+ * 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.cli.commands.realm;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.rest.api.service.RealmService;
+
+public class RealmSyncopeOperations {
+
+ private final RealmService realmService = SyncopeServices.get(RealmService.class);
+
+ public List<RealmTO> list() {
+ return realmService.list();
+ }
+
+ public boolean exists(final String realm) {
+ boolean exists = false;
+ for (final RealmTO list : list()) {
+ if (list.getName().equals(realm)) {
+ exists = true;
+ }
+ }
+ return exists;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
index e4c2394..38a7b2f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.report;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ReportService;
-
public abstract class AbstractReportCommand {
- protected final ReportService reportService = SyncopeServices.get(ReportService.class);
+ protected final ReportSyncopeOperations reportSyncopeOperations = new ReportSyncopeOperations();
protected final ReportResultManager reportResultManager = new ReportResultManager();
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
index 012d04f..aa2c5f8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
@@ -36,7 +36,7 @@ public class ReportDelete extends AbstractReportCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- reportService.delete(Long.valueOf(parameter));
+ reportSyncopeOperations.delete(parameter);
reportResultManager.deletedMessage("Report", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
@@ -47,7 +47,7 @@ public class ReportDelete extends AbstractReportCommand {
reportResultManager.generic(ex.getMessage());
}
} catch (final NumberFormatException ex) {
- reportResultManager.managerNumberFormatException("report", parameter);
+ reportResultManager.numberFormatException("report", parameter);
}
}
} else {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
index 4ab53fa..86f31a2 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
@@ -39,7 +39,7 @@ public class ReportDeleteExecution extends AbstractReportCommand {
for (final String parameter : input.getParameters()) {
try {
- reportService.deleteExecution(Long.valueOf(parameter));
+ reportSyncopeOperations.deleteExecution(parameter);
reportResultManager.deletedMessage("Report execution", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
@@ -50,7 +50,7 @@ public class ReportDeleteExecution extends AbstractReportCommand {
reportResultManager.generic(ex.getMessage());
}
} catch (final NumberFormatException ex) {
- reportResultManager.managerNumberFormatException("report", parameter);
+ reportResultManager.numberFormatException("report", parameter);
}
}
} else {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
index 311544d..0641203 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
@@ -39,10 +39,9 @@ public class ReportExecute extends AbstractReportCommand {
if (input.parameterNumber() == 1) {
try {
- final Long reportIdToExecute = Long.valueOf(input.firstParameter());
- reportService.execute(reportIdToExecute);
+ reportSyncopeOperations.execute(input.firstParameter());
final List<ReportExecTO> executionList
- = reportService.read(reportIdToExecute).getExecutions();
+ = reportSyncopeOperations.read(input.firstParameter()).getExecutions();
final ReportExecTO lastExecution = executionList.get(executionList.size() - 1);
reportResultManager.printReportExecution(Arrays.asList(lastExecution));
} catch (final WebServiceException | SyncopeClientException ex) {
@@ -54,7 +53,7 @@ public class ReportExecute extends AbstractReportCommand {
reportResultManager.generic(ex.getMessage());
}
} catch (final NumberFormatException ex) {
- reportResultManager.managerNumberFormatException("report", input.firstParameter());
+ reportResultManager.numberFormatException("report", input.firstParameter());
}
} else {
reportResultManager.commandOptionError(EXECUTE_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
index c55d339..ae79e57 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
@@ -49,12 +49,11 @@ public class ReportExportExecution extends AbstractReportCommand {
for (final String parameter : parameters) {
try {
final ReportExecExportFormat format = ReportExecExportFormat.valueOf(input.lastParameter());
- final Long exportId = Long.valueOf(parameter);
- final SequenceInputStream report = (SequenceInputStream) reportService.
- exportExecutionResult(exportId, format).getEntity();
+ final SequenceInputStream report = (SequenceInputStream) reportSyncopeOperations.
+ exportExecutionResult(parameter, format).getEntity();
switch (format) {
case XML:
- final String xmlFinalName = "export_" + exportId + ".xml";
+ final String xmlFinalName = "export_" + parameter + ".xml";
XMLUtils.createXMLFile(report, xmlFinalName);
reportResultManager.generic(xmlFinalName + " successfully created");
break;
@@ -75,14 +74,13 @@ public class ReportExportExecution extends AbstractReportCommand {
break;
}
} catch (final WebServiceException | SyncopeClientException ex) {
- ex.printStackTrace();
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
} else {
reportResultManager.generic(ex.getMessage());
}
} catch (final NumberFormatException ex) {
- reportResultManager.managerNumberFormatException("report", parameter);
+ reportResultManager.numberFormatException("report", parameter);
} catch (IOException | ParserConfigurationException | SAXException | TransformerException e) {
reportResultManager.generic(" - Error creating " + "export_" + parameter + " " + e.getMessage());
} catch (final IllegalArgumentException ex) {
[32/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
index 5424486..d9028af 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultUserProvisioningManager.java
@@ -47,9 +47,9 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationException
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,23 +75,32 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
protected UserDAO userDAO;
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO) {
- return create(userTO, true, false, null, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean nullPriorityAsync) {
+ return create(userTO, true, false, null, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword) {
- return create(userTO, storePassword, false, null, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(
+ final UserTO userTO, final boolean storePassword, final boolean nullPriorityAsync) {
+
+ return create(userTO, storePassword, false, null, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final Set<String> excludedResources) {
- return create(userTO, false, false, null, excludedResources);
+ public Pair<Long, List<PropagationStatus>> create(
+ final UserTO userTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
+ return create(userTO, false, false, null, excludedResources, nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword,
- final boolean disablePwdPolicyCheck, final Boolean enabled, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(
+ final UserTO userTO,
+ final boolean storePassword,
+ final boolean disablePwdPolicyCheck,
+ final Boolean enabled,
+ final Set<String> excludedResources,
+ final boolean nullPriorityAsync) {
WorkflowResult<Pair<Long, Boolean>> created =
uwfAdapter.create(userTO, disablePwdPolicyCheck, enabled, storePassword);
@@ -105,49 +114,46 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(created.getResult().getKey(), propagationReporter.getStatuses());
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final UserPatch userPatch) {
+ public Pair<Long, List<PropagationStatus>> update(final UserPatch userPatch, final boolean nullPriorityAsync) {
WorkflowResult<Pair<UserPatch, Boolean>> updated = uwfAdapter.update(userPatch);
List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(updated);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(updated.getResult().getKey().getKey(), propagationReporter.getStatuses());
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final UserPatch userPatch, final Set<String> excludedResources) {
- return update(userPatch, userPatch.getKey(), new ProvisioningResult(), null, excludedResources);
+ public Pair<Long, List<PropagationStatus>> update(
+ final UserPatch userPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
+ return update(userPatch, new ProvisioningReport(), null, excludedResources, nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final UserPatch userPatch, final Long key,
- final ProvisioningResult result, final Boolean enabled, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> update(
+ final UserPatch userPatch,
+ final ProvisioningReport result,
+ final Boolean enabled,
+ final Set<String> excludedResources,
+ final boolean nullPriorityAsync) {
WorkflowResult<Pair<UserPatch, Boolean>> updated;
try {
updated = uwfAdapter.update(userPatch);
} catch (Exception e) {
- LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)", key, e);
+ LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)",
+ userPatch.getKey(), e);
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + e.getMessage());
updated = new WorkflowResult<Pair<UserPatch, Boolean>>(
@@ -156,15 +162,15 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
if (enabled != null) {
- User user = userDAO.find(key);
+ User user = userDAO.find(userPatch.getKey());
WorkflowResult<Long> enableUpdate = null;
if (user.isSuspended() == null) {
- enableUpdate = uwfAdapter.activate(key, null);
+ enableUpdate = uwfAdapter.activate(userPatch.getKey(), null);
} else if (enabled && user.isSuspended()) {
- enableUpdate = uwfAdapter.reactivate(key);
+ enableUpdate = uwfAdapter.reactivate(userPatch.getKey());
} else if (!enabled && !user.isSuspended()) {
- enableUpdate = uwfAdapter.suspend(key);
+ enableUpdate = uwfAdapter.suspend(userPatch.getKey());
}
if (enableUpdate != null) {
@@ -180,23 +186,20 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
updated, updated.getResult().getKey().getPassword() != null, excludedResources);
PropagationReporter propagationReporter = ApplicationContextProvider.getBeanFactory().
getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(updated.getResult().getKey().getKey(), propagationReporter.getStatuses());
}
@Override
- public List<PropagationStatus> delete(final Long key) {
- return delete(key, Collections.<String>emptySet());
+ public List<PropagationStatus> delete(final Long key, final boolean nullPriorityAsync) {
+ return delete(key, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public List<PropagationStatus> delete(final Long key, final Set<String> excludedResources) {
+ public List<PropagationStatus> delete(
+ final Long key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.DELETE, userDAO.findAllResourceNames(userDAO.authFind(key)));
@@ -212,12 +215,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
try {
uwfAdapter.delete(key);
@@ -240,33 +238,41 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
}
@Override
- public Pair<Long, List<PropagationStatus>> activate(final StatusPatch statusPatch) {
+ public Pair<Long, List<PropagationStatus>> activate(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
WorkflowResult<Long> updated = statusPatch.isOnSyncope()
? uwfAdapter.activate(statusPatch.getKey(), statusPatch.getToken())
: new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase());
- return new ImmutablePair<>(updated.getResult(), propagateStatus(statusPatch));
+ return new ImmutablePair<>(updated.getResult(), propagateStatus(statusPatch, nullPriorityAsync));
}
@Override
- public Pair<Long, List<PropagationStatus>> reactivate(final StatusPatch statusPatch) {
+ public Pair<Long, List<PropagationStatus>> reactivate(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
WorkflowResult<Long> updated = statusPatch.isOnSyncope()
? uwfAdapter.reactivate(statusPatch.getKey())
: new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase());
- return new ImmutablePair<>(updated.getResult(), propagateStatus(statusPatch));
+ return new ImmutablePair<>(updated.getResult(), propagateStatus(statusPatch, nullPriorityAsync));
}
@Override
- public Pair<Long, List<PropagationStatus>> suspend(final StatusPatch statusPatch) {
+ public Pair<Long, List<PropagationStatus>> suspend(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
WorkflowResult<Long> updated = statusPatch.isOnSyncope()
? uwfAdapter.suspend(statusPatch.getKey())
: new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase());
- return new ImmutablePair<>(updated.getResult(), propagateStatus(statusPatch));
+ return new ImmutablePair<>(updated.getResult(), propagateStatus(statusPatch, nullPriorityAsync));
}
- protected List<PropagationStatus> propagateStatus(final StatusPatch statusPatch) {
+ protected List<PropagationStatus> propagateStatus(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, statusPatch.getResources());
List<PropagationTask> tasks = propagationManager.getUpdateTasks(
@@ -279,12 +285,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
null);
PropagationReporter propReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propReporter, nullPriorityAsync);
return propReporter.getStatuses();
}
@@ -308,7 +309,11 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
@Override
public List<PropagationStatus> provision(
- final Long key, final boolean changePwd, final String password, final Collection<String> resources) {
+ final Long key,
+ final boolean changePwd,
+ final String password,
+ final Collection<String> resources,
+ final boolean nullPriorityAsync) {
UserPatch userPatch = new UserPatch();
userPatch.setKey(key);
@@ -338,18 +343,15 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(wfResult, changePwd, null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return propagationReporter.getStatuses();
}
@Override
- public List<PropagationStatus> deprovision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.DELETE, resources);
@@ -360,12 +362,7 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
CollectionUtils.removeAll(userDAO.findAllResourceNames(userDAO.authFind(key)), resources));
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return propagationReporter.getStatuses();
}
@@ -383,11 +380,6 @@ public class DefaultUserProvisioningManager implements UserProvisioningManager {
PropagationReporter propReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propReporter, false);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
index 4af649f..bd7fb02 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
@@ -681,7 +681,10 @@ abstract class AbstractAnyDataBinder {
+ " on resource '" + resource.getKey() + "'");
}
- connObjectKeys.put(resource.getKey(), mappingUtils.getConnObjectKeyValue(any, provision));
+ String connObjectKey = mappingUtils.getConnObjectKeyValue(any, provision);
+ if (connObjectKey != null) {
+ connObjectKeys.put(resource.getKey(), connObjectKey);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
index dff71a0..5f0decf 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderImpl.java
@@ -101,8 +101,6 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resource.setEnforceMandatoryCondition(resourceTO.isEnforceMandatoryCondition());
- resource.setPropagationPrimary(resourceTO.isPropagationPrimary());
-
resource.setPropagationPriority(resourceTO.getPropagationPriority());
resource.setRandomPwdIfNotProvided(resourceTO.isRandomPwdIfNotProvided());
@@ -335,8 +333,6 @@ public class ResourceDataBinderImpl implements ResourceDataBinder {
resourceTO.setEnforceMandatoryCondition(resource.isEnforceMandatoryCondition());
- resourceTO.setPropagationPrimary(resource.isPropagationPrimary());
-
resourceTO.setPropagationPriority(resource.getPropagationPriority());
resourceTO.setRandomPwdIfNotProvided(resource.isRandomPwdIfNotProvided());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
----------------------------------------------------------------------
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 e0f8cd8..3207bd2 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
@@ -299,6 +299,7 @@ public class TaskDataBinderImpl implements TaskDataBinder {
+ task.getClass().getName());
}
((PropagationTaskTO) taskTO).setResource(((PropagationTask) task).getResource().getKey());
+ ((PropagationTaskTO) taskTO).setAttributes(((PropagationTask) task).getSerializedAttributes());
break;
case SCHEDULED:
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SchedulerShutdown.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SchedulerShutdown.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SchedulerShutdown.java
index 8129928..7104f52 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SchedulerShutdown.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SchedulerShutdown.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.core.provisioning.java.job;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
@@ -31,8 +29,6 @@ import org.springframework.scheduling.quartz.SchedulerFactoryBean;
*/
public class SchedulerShutdown implements ApplicationContextAware, DisposableBean {
- private static final Logger LOG = LoggerFactory.getLogger(SchedulerShutdown.class);
-
private ApplicationContext ctx;
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SpringBeanJobFactory.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SpringBeanJobFactory.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SpringBeanJobFactory.java
index 925c6e6..713566c 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SpringBeanJobFactory.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/SpringBeanJobFactory.java
@@ -51,10 +51,10 @@ public class SpringBeanJobFactory extends org.springframework.scheduling.quartz.
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
- final ApplicationContext ctx = ((ConfigurableApplicationContext) schedulerContext.get("applicationContext"));
+ ApplicationContext ctx = ((ConfigurableApplicationContext) schedulerContext.get("applicationContext"));
- final Object job = ctx.getBean(bundle.getJobDetail().getKey().getName());
- final BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(job);
+ Object job = ctx.getBean(bundle.getJobDetail().getKey().getName());
+ BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(job);
if (isEligibleForPropertyPopulation(wrapper.getWrappedInstance())) {
final MutablePropertyValues pvs = new MutablePropertyValues();
if (this.schedulerContext != null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
index fd4af1b..c6f08a3 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/notification/NotificationManagerImpl.java
@@ -35,6 +35,7 @@ import org.apache.syncope.common.lib.types.AuditElements.Result;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.core.persistence.api.dao.ConfDAO;
import org.apache.syncope.core.persistence.api.dao.NotificationDAO;
@@ -272,16 +273,22 @@ public class NotificationManagerImpl implements NotificationManager {
if (before instanceof UserTO) {
any = userDAO.find(((UserTO) before).getKey());
- } else if (output instanceof UserTO) {
- any = userDAO.find(((UserTO) output).getKey());
+ } else if (output instanceof ProvisioningResult
+ && ((ProvisioningResult) output).getAny() instanceof UserTO) {
+
+ any = userDAO.find(((ProvisioningResult) output).getAny().getKey());
} else if (before instanceof AnyObjectTO) {
any = anyObjectDAO.find(((AnyObjectTO) before).getKey());
- } else if (output instanceof AnyObjectTO) {
- any = anyObjectDAO.find(((AnyObjectTO) output).getKey());
+ } else if (output instanceof ProvisioningResult
+ && ((ProvisioningResult) output).getAny() instanceof AnyObjectTO) {
+
+ any = anyObjectDAO.find(((ProvisioningResult) output).getAny().getKey());
} else if (before instanceof GroupTO) {
any = groupDAO.find(((GroupTO) before).getKey());
- } else if (output instanceof GroupTO) {
- any = groupDAO.find(((GroupTO) output).getKey());
+ } else if (output instanceof ProvisioningResult
+ && ((ProvisioningResult) output).getAny() instanceof GroupTO) {
+
+ any = groupDAO.find(((ProvisioningResult) output).getAny().getKey());
}
AnyType anyType = any == null ? null : any.getType();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
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 d513069..cbc26f5 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
@@ -62,6 +62,7 @@ import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeUtil;
@@ -311,17 +312,17 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
} else {
/*
* We must choose here whether to
- * a. actually delete the provided user / group from the external resource
- * b. just update the provided user / group data onto the external resource
+ * a. actually delete the provided any object from the external resource
+ * b. just update the provided any object data onto the external resource
*
- * (a) happens when either there is no user / group associated with the PropagationTask (this takes place
+ * (a) happens when either there is no any object associated with the PropagationTask (this takes place
* when the task is generated via UserLogic.delete() / GroupLogic.delete()) or the provided updated
- * user / group hasn't the current resource assigned (when the task is generated via
+ * any object hasn't the current resource assigned (when the task is generated via
* UserController.update() / GroupLogic.update()).
*
- * (b) happens when the provided updated user / group does have the current resource assigned (when the task
+ * (b) happens when the provided updated any object does have the current resource assigned (when the task
* is generated via UserLogic.update() / GroupLogic.updae()): this basically means that before such
- * update, this user / group used to have the current resource assigned by more than one mean (for example,
+ * update, this any object used to have the current resource assigned by more than one mean (for example,
* two different memberships with the same resource).
*/
Any<?, ?> any = getAny(task);
@@ -452,13 +453,13 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
task.addExec(execution);
taskDAO.save(task);
- // this flush call is needed to generate a value for the execution id
+ // needed to generate a value for the execution key
taskDAO.flush();
}
if (reporter != null) {
- reporter.onSuccessOrSecondaryResourceFailures(
- task.getResource().getKey(),
+ reporter.onSuccessOrNonPriorityResourceFailures(
+ task,
PropagationTaskExecStatus.valueOf(execution.getStatus()),
failureReason,
beforeObj,
@@ -491,16 +492,30 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
@Override
public void execute(final Collection<PropagationTask> tasks) {
- execute(tasks, null);
+ execute(tasks, null, false);
}
+ protected abstract void doExecute(
+ Collection<PropagationTask> tasks, PropagationReporter reporter, boolean nullPriorityAsync);
+
@Override
- public abstract void execute(Collection<PropagationTask> tasks, final PropagationReporter reporter);
+ public void execute(
+ final Collection<PropagationTask> tasks,
+ final PropagationReporter reporter,
+ final boolean nullPriorityAsync) {
+
+ try {
+ doExecute(tasks, reporter, nullPriorityAsync);
+ } catch (PropagationException e) {
+ LOG.error("Error propagation priority resource", e);
+ reporter.onPriorityResourceFailure(e.getResourceName(), tasks);
+ }
+ }
/**
* Check whether an execution has to be stored, for a given task.
*
- * @param task execution's task
+ * @param task propagation task
* @param execution to be decide whether to store or not
* @return true if execution has to be store, false otherwise
*/
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
index d635e15..8e780f4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
@@ -19,7 +19,11 @@
package org.apache.syncope.core.provisioning.java.propagation;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
@@ -39,56 +43,68 @@ public class DefaultPropagationReporter implements PropagationReporter {
protected final List<PropagationStatus> statuses = new ArrayList<>();
+ protected boolean add(final PropagationStatus status) {
+ return CollectionUtils.exists(statuses, new Predicate<PropagationStatus>() {
+
+ @Override
+ public boolean evaluate(final PropagationStatus item) {
+ return item.getResource().equals(status.getResource());
+ }
+ })
+ ? false
+ : statuses.add(status);
+ }
+
@Override
- public void onSuccessOrSecondaryResourceFailures(final String resource,
+ public void onSuccessOrNonPriorityResourceFailures(
+ final PropagationTask propagationTask,
final PropagationTaskExecStatus executionStatus,
- final String failureReason, final ConnectorObject beforeObj, final ConnectorObject afterObj) {
+ final String failureReason,
+ final ConnectorObject beforeObj,
+ final ConnectorObject afterObj) {
- PropagationStatus propagation = new PropagationStatus();
- propagation.setResource(resource);
- propagation.setStatus(executionStatus);
- propagation.setFailureReason(failureReason);
+ PropagationStatus status = new PropagationStatus();
+ status.setResource(propagationTask.getResource().getKey());
+ status.setStatus(executionStatus);
+ status.setFailureReason(failureReason);
if (beforeObj != null) {
- propagation.setBeforeObj(connObjectUtils.getConnObjectTO(beforeObj));
+ status.setBeforeObj(connObjectUtils.getConnObjectTO(beforeObj));
}
if (afterObj != null) {
- propagation.setAfterObj(connObjectUtils.getConnObjectTO(afterObj));
+ status.setAfterObj(connObjectUtils.getConnObjectTO(afterObj));
}
- statuses.add(propagation);
- }
-
- private boolean containsPropagationStatusTO(final String resourceName) {
- for (PropagationStatus status : statuses) {
- if (resourceName.equals(status.getResource())) {
- return true;
- }
- }
- return false;
+ add(status);
}
@Override
- public void onPrimaryResourceFailure(final List<PropagationTask> tasks) {
- final String failedResource = statuses.get(statuses.size() - 1).getResource();
-
- LOG.debug("Propagation error: {} primary resource failed to propagate", failedResource);
-
- for (PropagationTask propagationTask : tasks) {
- if (!containsPropagationStatusTO(propagationTask.getResource().getKey())) {
- PropagationStatus propagationStatusTO = new PropagationStatus();
- propagationStatusTO.setResource(propagationTask.getResource().getKey());
- propagationStatusTO.setStatus(PropagationTaskExecStatus.FAILURE);
- propagationStatusTO.setFailureReason(
- "Propagation error: " + failedResource + " primary resource failed to propagate.");
- statuses.add(propagationStatusTO);
+ public void onPriorityResourceFailure(final String failingResource, final Collection<PropagationTask> tasks) {
+ LOG.debug("Propagation error: {} priority resource failed to propagate", failingResource);
+
+ final PropagationTask propagationTask = CollectionUtils.find(tasks, new Predicate<PropagationTask>() {
+
+ @Override
+ public boolean evaluate(final PropagationTask task) {
+ return task.getResource().getKey().equals(failingResource);
}
+ });
+
+ if (propagationTask == null) {
+ LOG.error("Could not find {} for {}", PropagationTask.class.getName(), failingResource);
+ } else {
+ PropagationStatus status = new PropagationStatus();
+ status.setResource(propagationTask.getResource().getKey());
+ status.setStatus(PropagationTaskExecStatus.FAILURE);
+ status.setFailureReason(
+ "Propagation error: " + failingResource + " priority resource failed to propagate.");
+ add(status);
}
}
@Override
public List<PropagationStatus> getStatuses() {
- return statuses;
+ return Collections.unmodifiableList(statuses);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/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 90d56ba..5ea6616 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
@@ -23,77 +23,139 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
-import org.apache.syncope.common.lib.types.AuditElements;
-import org.apache.syncope.common.lib.types.AuditElements.Result;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CompletionService;
+import java.util.concurrent.ExecutorCompletionService;
+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.types.PropagationTaskExecStatus;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskCallable;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
/**
- * Sort the given collection by looking at related ExternalResource's priority, then execute.
+ * Sorts the tasks to be executed according to related
+ * {@link org.apache.syncope.core.persistence.api.entity.resource.ExternalResource}'s priority, then execute.
+ * Tasks related to resources with NULL priority are executed after other tasks, concurrently.
+ * Failure during execution of a task related to resource with non-NULL priority are treated as fatal and will interrupt
+ * the whole process, resulting in a global failure.
*/
public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExecutor {
+ @Resource(name = "propagationTaskExecutorAsyncExecutor")
+ protected ThreadPoolTaskExecutor executor;
+
@Override
- public void execute(final Collection<PropagationTask> tasks, final PropagationReporter reporter) {
- List<PropagationTask> prioritizedTasks = new ArrayList<>(tasks);
- Collections.sort(prioritizedTasks, new PriorityComparator());
+ public PropagationTaskCallable newPropagationTaskCallable(
+ final PropagationTask task, final PropagationReporter reporter) {
- LOG.debug("Propagation tasks sorted by priority, before execution: {}", prioritizedTasks);
+ PropagationTaskCallable callable = (PropagationTaskCallable) ApplicationContextProvider.getBeanFactory().
+ createBean(PropagationTaskCallableImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
+ callable.setExecutor(this);
+ callable.setTask(task);
+ callable.setReporter(reporter);
- Result result = Result.SUCCESS;
+ return callable;
+ }
- try {
- for (PropagationTask task : prioritizedTasks) {
- LOG.debug("Execution started for {}", task);
+ @Override
+ protected void doExecute(
+ final Collection<PropagationTask> tasks,
+ final PropagationReporter reporter,
+ final boolean nullPriorityAsync) {
- TaskExec execution = execute(task, reporter);
+ List<PropagationTask> prioritizedTasks = CollectionUtils.select(tasks, new Predicate<PropagationTask>() {
- LOG.debug("Execution finished for {}, {}", task, execution);
+ @Override
+ public boolean evaluate(final PropagationTask task) {
+ return task.getResource().getPropagationPriority() != null;
+ }
+ }, new ArrayList<PropagationTask>());
+ Collections.sort(prioritizedTasks, new PriorityComparator());
+ LOG.debug("Propagation tasks sorted by priority, for serial execution: {}", prioritizedTasks);
- // Propagation is interrupted as soon as the result of the
- // communication with a primary resource is in error
- PropagationTaskExecStatus execStatus;
- try {
- execStatus = PropagationTaskExecStatus.valueOf(execution.getStatus());
- } catch (IllegalArgumentException e) {
- LOG.error("Unexpected execution status found {}", execution.getStatus());
- execStatus = PropagationTaskExecStatus.FAILURE;
+ Collection<PropagationTask> concurrentTasks = CollectionUtils.subtract(tasks, prioritizedTasks);
+ LOG.debug("Propagation tasks for concurrent execution: {}", concurrentTasks);
+
+ // first process priority resources sequentially and fail as soon as any propagation failure is reported
+ for (PropagationTask task : prioritizedTasks) {
+ TaskExec execution = null;
+ PropagationTaskExecStatus execStatus;
+ try {
+ execution = newPropagationTaskCallable(task, reporter).call();
+ execStatus = PropagationTaskExecStatus.valueOf(execution.getStatus());
+ } catch (Exception e) {
+ LOG.error("Unexpected exception", e);
+ execStatus = PropagationTaskExecStatus.FAILURE;
+ }
+ if (execStatus != PropagationTaskExecStatus.SUCCESS) {
+ throw new PropagationException(
+ task.getResource().getKey(), execution == null ? null : execution.getMessage());
+ }
+ }
+
+ // then process non-priority resources concurrently...
+ final CompletionService<TaskExec> completionService = new ExecutorCompletionService<>(executor);
+ Map<PropagationTask, Future<TaskExec>> nullPriority = new HashMap<>(concurrentTasks.size());
+ for (PropagationTask task : concurrentTasks) {
+ try {
+ nullPriority.put(
+ task,
+ completionService.submit(newPropagationTaskCallable(task, reporter)));
+ } catch (Exception e) {
+ LOG.error("Unexpected exception", e);
+ }
+ }
+ // ...waiting for all callables to complete, if async processing was not required
+ if (!nullPriority.isEmpty()) {
+ if (nullPriorityAsync) {
+ for (Map.Entry<PropagationTask, Future<TaskExec>> entry : nullPriority.entrySet()) {
+ reporter.onSuccessOrNonPriorityResourceFailures(
+ entry.getKey(), PropagationTaskExecStatus.CREATED, null, null, null);
}
- if (task.getResource().isPropagationPrimary() && execStatus != PropagationTaskExecStatus.SUCCESS) {
- result = Result.FAILURE;
- throw new PropagationException(task.getResource().getKey(), execution.getMessage());
+ } else {
+ final Set<Future<TaskExec>> nullPriorityFutures = new HashSet<>(nullPriority.values());
+ try {
+ executor.submit(new Runnable() {
+
+ @Override
+ public void run() {
+ while (!nullPriorityFutures.isEmpty()) {
+ try {
+ nullPriorityFutures.remove(completionService.take());
+ } catch (Exception e) {
+ LOG.error("Unexpected exception", e);
+ }
+ }
+ }
+ }).get(60, TimeUnit.SECONDS);
+ } catch (Exception e) {
+ LOG.error("Unexpected exception", e);
+ } finally {
+ for (Future<TaskExec> future : nullPriorityFutures) {
+ future.cancel(true);
+ }
+ nullPriorityFutures.clear();
+ nullPriority.clear();
}
}
- } finally {
- notificationManager.createTasks(
- AuditElements.EventCategoryType.PROPAGATION,
- null,
- null,
- null,
- result,
- reporter == null ? null : reporter.getStatuses(),
- tasks);
-
- auditManager.audit(
- AuditElements.EventCategoryType.PROPAGATION,
- null,
- null,
- null,
- result,
- reporter == null ? null : reporter.getStatuses(),
- tasks);
}
}
/**
* Compare propagation tasks according to related ExternalResource's priority.
- *
- * @see PropagationTask
- * @see org.apache.syncope.core.persistence.beans.ExternalResource#propagationPriority
*/
protected static class PriorityComparator implements Comparator<PropagationTask>, Serializable {
@@ -101,12 +163,8 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec
@Override
public int compare(final PropagationTask task1, final PropagationTask task2) {
- int prop1 = task1.getResource().getPropagationPriority() == null
- ? Integer.MIN_VALUE
- : task1.getResource().getPropagationPriority();
- int prop2 = task2.getResource().getPropagationPriority() == null
- ? Integer.MIN_VALUE
- : task2.getResource().getPropagationPriority();
+ int prop1 = task1.getResource().getPropagationPriority();
+ int prop2 = task2.getResource().getPropagationPriority();
return prop1 > prop2
? 1
@@ -115,4 +173,5 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec
: -1;
}
}
+
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationTaskCallableImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationTaskCallableImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationTaskCallableImpl.java
new file mode 100644
index 0000000..4e6b875
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationTaskCallableImpl.java
@@ -0,0 +1,94 @@
+/*
+ * 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.core.provisioning.java.propagation;
+
+import java.util.Collection;
+import org.apache.syncope.core.misc.security.AuthContextUtils;
+import org.apache.syncope.core.misc.security.SyncopeAuthenticationDetails;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskCallable;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional(rollbackFor = { Throwable.class })
+public class PropagationTaskCallableImpl implements PropagationTaskCallable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PropagationTaskCallable.class);
+
+ private final String domain;
+
+ private final String username;
+
+ private final Collection<? extends GrantedAuthority> authorities;
+
+ private PropagationTaskExecutor executor;
+
+ private PropagationTask task;
+
+ private PropagationReporter reporter;
+
+ public PropagationTaskCallableImpl() {
+ SecurityContext ctx = SecurityContextHolder.getContext();
+ domain = AuthContextUtils.getDomain();
+ username = ctx.getAuthentication().getName();
+ authorities = ctx.getAuthentication().getAuthorities();
+ }
+
+ @Override
+ public void setExecutor(final PropagationTaskExecutor executor) {
+ this.executor = executor;
+ }
+
+ @Override
+ public void setTask(final PropagationTask task) {
+ this.task = task;
+ }
+
+ @Override
+ public void setReporter(final PropagationReporter reporter) {
+ this.reporter = reporter;
+ }
+
+ @Override
+ public TaskExec call() throws Exception {
+ // set security context according to the one gathered at instantiation time from the calling thread
+ UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
+ new User(username, "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
+ auth.setDetails(new SyncopeAuthenticationDetails(domain));
+ SecurityContextHolder.getContext().setAuthentication(auth);
+
+ LOG.debug("Execution started for {}", task);
+
+ TaskExec execution = executor.execute(task, reporter);
+
+ LOG.debug("Execution completed for {}, {}", task, execution);
+
+ return execution;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJobDelegate.java
index 0c8deb2..d6f4c15 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractProvisioningJobDelegate.java
@@ -34,7 +34,7 @@ import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.ConnectorFactory;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.provisioning.java.job.AbstractSchedTaskJobDelegate;
import org.apache.syncope.core.provisioning.java.job.TaskJob;
import org.quartz.JobExecutionException;
@@ -75,7 +75,7 @@ public abstract class AbstractProvisioningJobDelegate<T extends ProvisioningTask
* @param dryRun dry run?
* @return report as string
*/
- protected String createReport(final Collection<ProvisioningResult> provResults, final TraceLevel syncTraceLevel,
+ protected String createReport(final Collection<ProvisioningReport> provResults, final TraceLevel syncTraceLevel,
final boolean dryRun) {
if (syncTraceLevel == TraceLevel.NONE) {
@@ -88,32 +88,32 @@ public abstract class AbstractProvisioningJobDelegate<T extends ProvisioningTask
report.append("==>Dry run only, no modifications were made<==\n\n");
}
- List<ProvisioningResult> uSuccCreate = new ArrayList<>();
- List<ProvisioningResult> uFailCreate = new ArrayList<>();
- List<ProvisioningResult> uSuccUpdate = new ArrayList<>();
- List<ProvisioningResult> uFailUpdate = new ArrayList<>();
- List<ProvisioningResult> uSuccDelete = new ArrayList<>();
- List<ProvisioningResult> uFailDelete = new ArrayList<>();
- List<ProvisioningResult> uSuccNone = new ArrayList<>();
- List<ProvisioningResult> uIgnore = new ArrayList<>();
- List<ProvisioningResult> gSuccCreate = new ArrayList<>();
- List<ProvisioningResult> gFailCreate = new ArrayList<>();
- List<ProvisioningResult> gSuccUpdate = new ArrayList<>();
- List<ProvisioningResult> gFailUpdate = new ArrayList<>();
- List<ProvisioningResult> gSuccDelete = new ArrayList<>();
- List<ProvisioningResult> gFailDelete = new ArrayList<>();
- List<ProvisioningResult> gSuccNone = new ArrayList<>();
- List<ProvisioningResult> gIgnore = new ArrayList<>();
- List<ProvisioningResult> aSuccCreate = new ArrayList<>();
- List<ProvisioningResult> aFailCreate = new ArrayList<>();
- List<ProvisioningResult> aSuccUpdate = new ArrayList<>();
- List<ProvisioningResult> aFailUpdate = new ArrayList<>();
- List<ProvisioningResult> aSuccDelete = new ArrayList<>();
- List<ProvisioningResult> aFailDelete = new ArrayList<>();
- List<ProvisioningResult> aSuccNone = new ArrayList<>();
- List<ProvisioningResult> aIgnore = new ArrayList<>();
-
- for (ProvisioningResult provResult : provResults) {
+ List<ProvisioningReport> uSuccCreate = new ArrayList<>();
+ List<ProvisioningReport> uFailCreate = new ArrayList<>();
+ List<ProvisioningReport> uSuccUpdate = new ArrayList<>();
+ List<ProvisioningReport> uFailUpdate = new ArrayList<>();
+ List<ProvisioningReport> uSuccDelete = new ArrayList<>();
+ List<ProvisioningReport> uFailDelete = new ArrayList<>();
+ List<ProvisioningReport> uSuccNone = new ArrayList<>();
+ List<ProvisioningReport> uIgnore = new ArrayList<>();
+ List<ProvisioningReport> gSuccCreate = new ArrayList<>();
+ List<ProvisioningReport> gFailCreate = new ArrayList<>();
+ List<ProvisioningReport> gSuccUpdate = new ArrayList<>();
+ List<ProvisioningReport> gFailUpdate = new ArrayList<>();
+ List<ProvisioningReport> gSuccDelete = new ArrayList<>();
+ List<ProvisioningReport> gFailDelete = new ArrayList<>();
+ List<ProvisioningReport> gSuccNone = new ArrayList<>();
+ List<ProvisioningReport> gIgnore = new ArrayList<>();
+ List<ProvisioningReport> aSuccCreate = new ArrayList<>();
+ List<ProvisioningReport> aFailCreate = new ArrayList<>();
+ List<ProvisioningReport> aSuccUpdate = new ArrayList<>();
+ List<ProvisioningReport> aFailUpdate = new ArrayList<>();
+ List<ProvisioningReport> aSuccDelete = new ArrayList<>();
+ List<ProvisioningReport> aFailDelete = new ArrayList<>();
+ List<ProvisioningReport> aSuccNone = new ArrayList<>();
+ List<ProvisioningReport> aIgnore = new ArrayList<>();
+
+ for (ProvisioningReport provResult : provResults) {
AnyType anyType = anyTypeDAO.find(provResult.getAnyType());
switch (provResult.getStatus()) {
@@ -293,76 +293,76 @@ public abstract class AbstractProvisioningJobDelegate<T extends ProvisioningTask
if (syncTraceLevel == TraceLevel.FAILURES || syncTraceLevel == TraceLevel.ALL) {
if (!uFailCreate.isEmpty()) {
report.append("\n\nUsers failed to create: ");
- report.append(ProvisioningResult.produceReport(uFailCreate, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(uFailCreate, syncTraceLevel));
}
if (!uFailUpdate.isEmpty()) {
report.append("\nUsers failed to update: ");
- report.append(ProvisioningResult.produceReport(uFailUpdate, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(uFailUpdate, syncTraceLevel));
}
if (!uFailDelete.isEmpty()) {
report.append("\nUsers failed to delete: ");
- report.append(ProvisioningResult.produceReport(uFailDelete, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(uFailDelete, syncTraceLevel));
}
if (!gFailCreate.isEmpty()) {
report.append("\n\nGroups failed to create: ");
- report.append(ProvisioningResult.produceReport(gFailCreate, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(gFailCreate, syncTraceLevel));
}
if (!gFailUpdate.isEmpty()) {
report.append("\nGroups failed to update: ");
- report.append(ProvisioningResult.produceReport(gFailUpdate, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(gFailUpdate, syncTraceLevel));
}
if (!gFailDelete.isEmpty()) {
report.append("\nGroups failed to delete: ");
- report.append(ProvisioningResult.produceReport(gFailDelete, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(gFailDelete, syncTraceLevel));
}
if (!aFailCreate.isEmpty()) {
report.append("\nAny objects failed to create: ");
- report.append(ProvisioningResult.produceReport(aFailCreate, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(aFailCreate, syncTraceLevel));
}
if (!aFailUpdate.isEmpty()) {
report.append("\nAny objects failed to update: ");
- report.append(ProvisioningResult.produceReport(aFailUpdate, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(aFailUpdate, syncTraceLevel));
}
if (!aFailDelete.isEmpty()) {
report.append("\nAny objects failed to delete: ");
- report.append(ProvisioningResult.produceReport(aFailDelete, syncTraceLevel));
+ report.append(ProvisioningReport.produceReport(aFailDelete, syncTraceLevel));
}
}
// Succeeded, only if on 'ALL' level
if (syncTraceLevel == TraceLevel.ALL) {
report.append("\n\nUsers created:\n").
- append(ProvisioningResult.produceReport(uSuccCreate, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(uSuccCreate, syncTraceLevel)).
append("\nUsers updated:\n").
- append(ProvisioningResult.produceReport(uSuccUpdate, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(uSuccUpdate, syncTraceLevel)).
append("\nUsers deleted:\n").
- append(ProvisioningResult.produceReport(uSuccDelete, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(uSuccDelete, syncTraceLevel)).
append("\nUsers no operation:\n").
- append(ProvisioningResult.produceReport(uSuccNone, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(uSuccNone, syncTraceLevel)).
append("\nUsers ignored:\n").
- append(ProvisioningResult.produceReport(uIgnore, syncTraceLevel));
+ append(ProvisioningReport.produceReport(uIgnore, syncTraceLevel));
report.append("\n\nGroups created:\n").
- append(ProvisioningResult.produceReport(gSuccCreate, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(gSuccCreate, syncTraceLevel)).
append("\nGroups updated:\n").
- append(ProvisioningResult.produceReport(gSuccUpdate, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(gSuccUpdate, syncTraceLevel)).
append("\nGroups deleted:\n").
- append(ProvisioningResult.produceReport(gSuccDelete, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(gSuccDelete, syncTraceLevel)).
append("\nGroups no operation:\n").
- append(ProvisioningResult.produceReport(gSuccNone, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(gSuccNone, syncTraceLevel)).
append("\nGroups ignored:\n").
- append(ProvisioningResult.produceReport(gSuccNone, syncTraceLevel));
+ append(ProvisioningReport.produceReport(gSuccNone, syncTraceLevel));
report.append("\n\nAny objects created:\n").
- append(ProvisioningResult.produceReport(aSuccCreate, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(aSuccCreate, syncTraceLevel)).
append("\nAny objects updated:\n").
- append(ProvisioningResult.produceReport(aSuccUpdate, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(aSuccUpdate, syncTraceLevel)).
append("\nAny objects deleted:\n").
- append(ProvisioningResult.produceReport(aSuccDelete, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(aSuccDelete, syncTraceLevel)).
append("\nAny objects no operation:\n").
- append(ProvisioningResult.produceReport(aSuccNone, syncTraceLevel)).
+ append(ProvisioningReport.produceReport(aSuccNone, syncTraceLevel)).
append("\nAny objects ignored:\n").
- append(ProvisioningResult.produceReport(aSuccNone, syncTraceLevel));
+ append(ProvisioningReport.produceReport(aSuccNone, syncTraceLevel));
}
return report.toString();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
index f938faf..5daea51 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractPushResultHandler.java
@@ -35,7 +35,7 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.common.lib.types.UnmatchingRule;
import org.apache.syncope.core.persistence.api.entity.task.PushTask;
import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.provisioning.api.sync.PushActions;
import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.entity.Any;
@@ -154,10 +154,10 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
doHandle(any);
return true;
} catch (IgnoreProvisionException e) {
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.NONE);
result.setAnyType(any == null ? null : any.getType().getKey());
- result.setStatus(ProvisioningResult.Status.IGNORE);
+ result.setStatus(ProvisioningReport.Status.IGNORE);
result.setKey(anyKey);
profile.getResults().add(result);
@@ -172,7 +172,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
protected final void doHandle(final Any<?, ?> any) throws JobExecutionException {
AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
profile.getResults().add(result);
result.setKey(any.getKey());
@@ -204,7 +204,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
} else {
result.setOperation(getResourceOperation(profile.getTask().getMatchingRule()));
}
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
} else {
try {
if (beforeObj == null) {
@@ -338,13 +338,13 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
action.after(this.getProfile(), any, result);
}
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
resultStatus = AuditElements.Result.SUCCESS;
output = getRemoteObject(connObjecKey, provision.getObjectClass());
} catch (IgnoreProvisionException e) {
throw e;
} catch (Exception e) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
resultStatus = AuditElements.Result.FAILURE;
output = e;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
index 3967f2b..2c5bbb9 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AbstractSyncResultHandler.java
@@ -46,7 +46,7 @@ import org.apache.syncope.core.provisioning.api.ProvisioningManager;
import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue;
import org.apache.syncope.core.provisioning.api.sync.IgnoreProvisionException;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.provisioning.api.sync.SyncopeSyncResultHandler;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -72,7 +72,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
protected abstract ProvisioningManager<?, ?> getProvisioningManager();
- protected abstract AnyTO doCreate(AnyTO anyTO, SyncDelta delta, ProvisioningResult result);
+ protected abstract AnyTO doCreate(AnyTO anyTO, SyncDelta delta, ProvisioningReport result);
protected AnyTO doLink(final AnyTO before, final boolean unlink) {
AnyPatch patch = newPatch(before.getKey());
@@ -84,7 +84,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
return getAnyTO(update(patch).getResult());
}
- protected abstract AnyTO doUpdate(AnyTO before, AnyPatch anyPatch, SyncDelta delta, ProvisioningResult result);
+ protected abstract AnyTO doUpdate(AnyTO before, AnyPatch anyPatch, SyncDelta delta, ProvisioningReport result);
protected void doDeprovision(final AnyTypeKind kind, final Long key, final boolean unlink) {
PropagationByResource propByRes = new PropagationByResource();
@@ -118,7 +118,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
LOG.error("Could not propagate anyObject " + key, e);
}
- getProvisioningManager().delete(key);
+ getProvisioningManager().delete(key, true);
}
@Override
@@ -134,11 +134,11 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
doHandle(delta, provision);
return true;
} catch (IgnoreProvisionException e) {
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.NONE);
result.setAnyType(provision == null
? getAnyUtils().getAnyTypeKind().name() : provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.IGNORE);
+ result.setStatus(ProvisioningReport.Status.IGNORE);
result.setKey(0L);
result.setName(delta.getObject().getName().getNameValue());
profile.getResults().add(result);
@@ -151,23 +151,23 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
}
}
- protected List<ProvisioningResult> assign(
+ protected List<ProvisioningReport> assign(
final SyncDelta delta, final Provision provision, final AnyUtils anyUtils)
throws JobExecutionException {
if (!profile.getTask().isPerformCreate()) {
LOG.debug("SyncTask not configured for create");
- return Collections.<ProvisioningResult>emptyList();
+ return Collections.<ProvisioningReport>emptyList();
}
AnyTO anyTO = connObjectUtils.getAnyTO(delta.getObject(), profile.getTask(), provision, anyUtils);
anyTO.getResources().add(profile.getTask().getResource().getKey());
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.CREATE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
result.setName(getName(anyTO));
if (profile.isDryRun()) {
@@ -184,21 +184,21 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
return Collections.singletonList(result);
}
- protected List<ProvisioningResult> provision(
+ protected List<ProvisioningReport> provision(
final SyncDelta delta, final Provision provision, final AnyUtils anyUtils)
throws JobExecutionException {
if (!profile.getTask().isPerformCreate()) {
LOG.debug("SyncTask not configured for create");
- return Collections.<ProvisioningResult>emptyList();
+ return Collections.<ProvisioningReport>emptyList();
}
AnyTO anyTO = connObjectUtils.getAnyTO(delta.getObject(), profile.getTask(), provision, anyUtils);
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.CREATE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
result.setName(getName(anyTO));
if (profile.isDryRun()) {
@@ -219,7 +219,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
final AnyTO anyTO,
final SyncDelta delta,
final String operation,
- final ProvisioningResult result)
+ final ProvisioningReport result)
throws JobExecutionException {
Object output;
@@ -247,7 +247,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
action.onError(this.getProfile(), delta, result, e);
}
} catch (Exception e) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
LOG.error("Could not create {} {} ", anyTO.getType(), delta.getUid().getUidValue(), e);
output = e;
@@ -261,31 +261,31 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
audit(operation, resultStatus, null, output, delta);
}
- protected List<ProvisioningResult> update(final SyncDelta delta, final List<Long> anys,
+ protected List<ProvisioningReport> update(final SyncDelta delta, final List<Long> anys,
final Provision provision) throws JobExecutionException {
if (!profile.getTask().isPerformUpdate()) {
LOG.debug("SyncTask not configured for update");
- return Collections.<ProvisioningResult>emptyList();
+ return Collections.<ProvisioningReport>emptyList();
}
LOG.debug("About to update {}", anys);
- List<ProvisioningResult> results = new ArrayList<>();
+ List<ProvisioningReport> results = new ArrayList<>();
SyncDelta workingDelta = delta;
for (Long key : anys) {
LOG.debug("About to update {}", key);
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.UPDATE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
result.setKey(key);
AnyTO before = getAnyTO(key);
if (before == null) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(String.format("Any '%s(%d)' not found", provision.getAnyType().getKey(), key));
} else {
result.setName(getName(before));
@@ -335,7 +335,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
action.onError(this.getProfile(), workingDelta, result, e);
}
} catch (Exception e) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
LOG.error("Could not update {} {}",
provision.getAnyType().getKey(), workingDelta.getUid().getUidValue(), e);
@@ -354,7 +354,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
return results;
}
- protected List<ProvisioningResult> deprovision(
+ protected List<ProvisioningReport> deprovision(
final SyncDelta delta,
final List<Long> anys,
final Provision provision,
@@ -363,12 +363,12 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (!profile.getTask().isPerformUpdate()) {
LOG.debug("SyncTask not configured for update");
- return Collections.<ProvisioningResult>emptyList();
+ return Collections.<ProvisioningReport>emptyList();
}
LOG.debug("About to update {}", anys);
- final List<ProvisioningResult> updResults = new ArrayList<>();
+ final List<ProvisioningReport> updResults = new ArrayList<>();
for (Long key : anys) {
LOG.debug("About to unassign resource {}", key);
@@ -376,16 +376,16 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
Object output;
Result resultStatus;
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.DELETE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
result.setKey(key);
AnyTO before = getAnyTO(key);
if (before == null) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(String.format("Any '%s(%d)' not found", provision.getAnyType().getKey(), key));
}
@@ -430,7 +430,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
action.onError(this.getProfile(), delta, result, e);
}
} catch (Exception e) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
LOG.error("Could not update {} {}",
provision.getAnyType().getKey(), delta.getUid().getUidValue(), e);
@@ -452,7 +452,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
return updResults;
}
- protected List<ProvisioningResult> link(
+ protected List<ProvisioningReport> link(
final SyncDelta delta,
final List<Long> anys,
final Provision provision,
@@ -461,12 +461,12 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (!profile.getTask().isPerformUpdate()) {
LOG.debug("SyncTask not configured for update");
- return Collections.<ProvisioningResult>emptyList();
+ return Collections.<ProvisioningReport>emptyList();
}
LOG.debug("About to update {}", anys);
- final List<ProvisioningResult> updResults = new ArrayList<>();
+ final List<ProvisioningReport> updResults = new ArrayList<>();
for (Long key : anys) {
LOG.debug("About to unassign resource {}", key);
@@ -474,16 +474,16 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
Object output;
Result resultStatus;
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
result.setOperation(ResourceOperation.NONE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
result.setKey(key);
AnyTO before = getAnyTO(key);
if (before == null) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(String.format("Any '%s(%d)' not found", provision.getAnyType().getKey(), key));
}
@@ -527,7 +527,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
action.onError(this.getProfile(), delta, result, e);
}
} catch (Exception e) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
LOG.error("Could not update {} {}",
provision.getAnyType().getKey(), delta.getUid().getUidValue(), e);
@@ -548,7 +548,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
return updResults;
}
- protected List<ProvisioningResult> delete(
+ protected List<ProvisioningReport> delete(
final SyncDelta delta,
final List<Long> anys,
final Provision provision)
@@ -556,19 +556,19 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
if (!profile.getTask().isPerformDelete()) {
LOG.debug("SyncTask not configured for delete");
- return Collections.<ProvisioningResult>emptyList();
+ return Collections.<ProvisioningReport>emptyList();
}
LOG.debug("About to delete {}", anys);
- List<ProvisioningResult> delResults = new ArrayList<>();
+ List<ProvisioningReport> delResults = new ArrayList<>();
SyncDelta workingDelta = delta;
for (Long key : anys) {
Object output;
Result resultStatus = Result.FAILURE;
- ProvisioningResult result = new ProvisioningResult();
+ ProvisioningReport result = new ProvisioningReport();
try {
AnyTO before = getAnyTO(key);
@@ -577,7 +577,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
result.setName(getName(before));
result.setOperation(ResourceOperation.DELETE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
if (!profile.isDryRun()) {
for (SyncActions action : profile.getActions()) {
@@ -595,7 +595,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
} catch (IgnoreProvisionException e) {
throw e;
} catch (Exception e) {
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage(ExceptionUtils.getRootCauseMessage(e));
LOG.error("Could not delete {} {}", provision.getAnyType().getKey(), key, e);
output = e;
@@ -621,7 +621,7 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
return delResults;
}
- private List<ProvisioningResult> ignore(
+ private List<ProvisioningReport> ignore(
final SyncDelta delta,
final Provision provision,
final boolean matching)
@@ -629,14 +629,14 @@ public abstract class AbstractSyncResultHandler extends AbstractSyncopeResultHan
LOG.debug("Any to ignore {}", delta.getObject().getUid().getUidValue());
- final List<ProvisioningResult> ignoreResults = new ArrayList<>();
- ProvisioningResult result = new ProvisioningResult();
+ final List<ProvisioningReport> ignoreResults = new ArrayList<>();
+ ProvisioningReport result = new ProvisioningReport();
result.setKey(null);
result.setName(delta.getObject().getUid().getUidValue());
result.setOperation(ResourceOperation.NONE);
result.setAnyType(provision.getAnyType().getKey());
- result.setStatus(ProvisioningResult.Status.SUCCESS);
+ result.setStatus(ProvisioningReport.Status.SUCCESS);
ignoreResults.add(result);
if (!profile.isDryRun()) {
[41/50] [abbrv] syncope git commit: added details option, SYNCOPE-158
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
deleted file mode 100644
index 7316768..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.user;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-
-public class UserCount extends AbstractUserCommand {
-
- private static final String COUNT_HELP_MESSAGE = "user --count";
-
- private final Input input;
-
- public UserCount(final Input input) {
- this.input = input;
- }
-
- public void count() {
- if (input.parameterNumber() == 0) {
- try {
- userResultManager.genericMessage("Total users: " + userSyncopeOperations.count());
- } catch (final SyncopeClientException ex) {
- userResultManager.genericError(ex.getMessage());
- }
- } else {
- userResultManager.unnecessaryParameters(input.listParameters(), COUNT_HELP_MESSAGE);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDetails.java
new file mode 100644
index 0000000..f09b4ad
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDetails.java
@@ -0,0 +1,73 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserDetails extends AbstractUserCommand {
+
+ private static final String COUNT_HELP_MESSAGE = "user --details";
+
+ private final Input input;
+
+ public UserDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<UserTO> usersTOs = userSyncopeOperations.list().getResult();
+ int withoutResource = 0;
+ int withoutRole = 0;
+ int activeStatus = 0;
+ int suspendedStatus = 0;
+ for (final UserTO userTO : usersTOs) {
+ if (!userTO.getResources().isEmpty()) {
+ withoutResource++;
+ }
+ if (!userTO.getRoles().isEmpty()) {
+ withoutRole++;
+ }
+ if ("active".equalsIgnoreCase(userTO.getStatus())) {
+ activeStatus++;
+ } else if ("suspended".equalsIgnoreCase(userTO.getStatus())) {
+ suspendedStatus++;
+ }
+ }
+ details.put("Total number", String.valueOf(usersTOs.size()));
+ details.put("Active", String.valueOf(activeStatus));
+ details.put("Suspended", String.valueOf(suspendedStatus));
+ details.put("Without resources", String.valueOf(withoutResource));
+ details.put("Without roles", String.valueOf(withoutRole));
+ userResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ userResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ userResultManager.unnecessaryParameters(input.listParameters(), COUNT_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
index b175842..ccc8631 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.user;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.to.AttrTO;
@@ -104,4 +105,8 @@ public class UserResultManager extends CommonsResultManager {
System.out.println(" type: " + relationshipTO.getType());
}
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("users details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
index 0496d97..8df901f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
@@ -64,10 +64,6 @@ public class UserSyncopeOperations {
userService.delete(Long.valueOf(userId));
}
- public int count() {
- return list().getResult().size();
- }
-
public String getUsernameFromId(final String userId) {
return userService.getUsername(Long.valueOf(userId)).getHeaderString(RESTHeaders.USERNAME);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java
index 5230f42..3c872fc 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java
@@ -55,6 +55,7 @@ public final class Table {
}
public void print() {
+ System.out.println("");
columnsNumber = headers.size();
tmpValuesArray = new String[columnsNumber];
@@ -69,6 +70,7 @@ public final class Table {
printBorder();
printeContent();
printBorder();
+ System.out.println("");
}
private void buildTableContentFormat() {
[42/50] [abbrv] syncope git commit: added details option, SYNCOPE-158
Posted by fm...@apache.org.
added details option, SYNCOPE-158
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d43268c1
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d43268c1
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d43268c1
Branch: refs/heads/SYNCOPE-156
Commit: d43268c10f022e9707b01a95ffdc55c37e91b05e
Parents: 714557e
Author: massi <ma...@tirasa.net>
Authored: Fri Oct 30 11:18:47 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Fri Oct 30 11:18:55 2015 +0100
----------------------------------------------------------------------
.../cli/commands/CommonsResultManager.java | 13 ++
.../commands/connector/ConnectorCommand.java | 5 +
.../commands/connector/ConnectorDetails.java | 76 ++++++++++
.../connector/ConnectorResultManager.java | 7 +-
.../cli/commands/domain/DomainCommand.java | 5 +
.../cli/commands/domain/DomainDetails.java | 50 +++++++
.../commands/domain/DomainResultManager.java | 5 +
.../cli/commands/logger/LoggerCommand.java | 5 +
.../cli/commands/logger/LoggerDetails.java | 93 +++++++++++++
.../commands/logger/LoggerResultManager.java | 5 +
.../commands/notification/NotificationList.java | 5 +-
.../commands/notification/NotificationRead.java | 2 +-
.../notification/NotificationResultManager.java | 23 ++++
.../cli/commands/policy/PolicyCommand.java | 5 +
.../cli/commands/policy/PolicyDetails.java | 60 ++++++++
.../client/cli/commands/policy/PolicyList.java | 1 -
.../commands/policy/PolicyResultManager.java | 5 +
.../client/cli/commands/realm/RealmCommand.java | 5 +
.../client/cli/commands/realm/RealmDetails.java | 49 +++++++
.../cli/commands/realm/RealmResultManager.java | 5 +
.../cli/commands/report/ReportCommand.java | 5 +
.../cli/commands/report/ReportDetails.java | 59 ++++++++
.../client/cli/commands/report/ReportList.java | 4 +-
.../client/cli/commands/report/ReportRead.java | 2 +-
.../commands/report/ReportResultManager.java | 9 +-
.../cli/commands/resource/ResourceCommand.java | 5 +
.../cli/commands/resource/ResourceDetails.java | 52 +++++++
.../resource/ResourceResultManager.java | 8 ++
.../client/cli/commands/role/RoleCommand.java | 5 +
.../client/cli/commands/role/RoleDetails.java | 59 ++++++++
.../cli/commands/role/RoleResultManager.java | 5 +
.../cli/commands/schema/SchemaCommand.java | 5 +
.../cli/commands/schema/SchemaDetails.java | 58 ++++++++
.../commands/schema/SchemaResultManager.java | 5 +
.../client/cli/commands/task/TaskCommand.java | 5 +
.../client/cli/commands/task/TaskDetails.java | 137 +++++++++++++++++++
.../client/cli/commands/task/TaskList.java | 3 +-
.../cli/commands/task/TaskResultManager.java | 35 +++--
.../commands/task/TaskSyncopeOperations.java | 5 +-
.../client/cli/commands/user/UserCommand.java | 8 +-
.../client/cli/commands/user/UserCount.java | 45 ------
.../client/cli/commands/user/UserDetails.java | 73 ++++++++++
.../cli/commands/user/UserResultManager.java | 5 +
.../commands/user/UserSyncopeOperations.java | 4 -
.../apache/syncope/client/cli/view/Table.java | 2 +
45 files changed, 941 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
index 4764d4d..26873a1 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
@@ -18,9 +18,13 @@
*/
package org.apache.syncope.client.cli.commands;
+import java.util.Arrays;
+import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.syncope.client.cli.view.Messages;
+import org.apache.syncope.client.cli.view.Table;
import org.apache.syncope.common.lib.types.ConnConfProperty;
public abstract class CommonsResultManager {
@@ -80,4 +84,13 @@ public abstract class CommonsResultManager {
System.out.println("");
}
}
+
+ protected void printDetails(final String title, final Map<String, String> details) {
+ final Table.TableBuilder tableBuilder
+ = new Table.TableBuilder(title).header("detail").header("value");
+ for (final Map.Entry<String, String> entrySet : details.entrySet()) {
+ tableBuilder.rowValues(new LinkedList(Arrays.asList(entrySet.getKey(), entrySet.getValue())));
+ }
+ tableBuilder.build().print();
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
index c87055c..0110156 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
@@ -31,6 +31,7 @@ public class ConnectorCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: connector [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list \n"
+ " --list-bundles \n"
+ " --list-configuration-properties\n"
@@ -47,6 +48,9 @@ public class ConnectorCommand extends AbstractCommand {
}
switch (ConnectorOptions.fromName(input.getOption())) {
+ case DETAILS:
+ new ConnectorDetails(input).details();
+ break;
case LIST:
new ConnectorList(input).list();
break;
@@ -82,6 +86,7 @@ public class ConnectorCommand extends AbstractCommand {
HELP("--help"),
LIST("--list"),
+ DETAILS("--details"),
LIST_BUNDLES("--list-bundles"),
LIST_CONFIGURATION("--list-configuration-properties"),
READ("--read"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java
new file mode 100644
index 0000000..deb43ef
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java
@@ -0,0 +1,76 @@
+/*
+ * 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.cli.commands.connector;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
+
+public class ConnectorDetails extends AbstractConnectorCommand {
+
+ private static final String LIST_HELP_MESSAGE = "connector --details";
+
+ private final Input input;
+
+ public ConnectorDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<ConnInstanceTO> connInstanceTOs = connectorSyncopeOperations.list();
+ int withCreateCapability = 0;
+ int withDeleteCapability = 0;
+ int withSearchCapability = 0;
+ int withSyncCapability = 0;
+ int withUpdateCapability = 0;
+ for (final ConnInstanceTO connInstanceTO : connInstanceTOs) {
+ if (connInstanceTO.getCapabilities().contains(ConnectorCapability.CREATE)) {
+ withCreateCapability++;
+ }
+ if (connInstanceTO.getCapabilities().contains(ConnectorCapability.DELETE)) {
+ withDeleteCapability++;
+ }
+ if (connInstanceTO.getCapabilities().contains(ConnectorCapability.SEARCH)) {
+ withSearchCapability++;
+ }
+ if (connInstanceTO.getCapabilities().contains(ConnectorCapability.SYNC)) {
+ withSyncCapability++;
+ }
+ if (connInstanceTO.getCapabilities().contains(ConnectorCapability.UPDATE)) {
+ withUpdateCapability++;
+ }
+ }
+ details.put("Total number", String.valueOf(connInstanceTOs.size()));
+ details.put("With create capability", String.valueOf(withCreateCapability));
+ details.put("With delete capability", String.valueOf(withDeleteCapability));
+ details.put("With search capability", String.valueOf(withSearchCapability));
+ details.put("With sync capability", String.valueOf(withSyncCapability));
+ details.put("With update capability", String.valueOf(withUpdateCapability));
+ details.put("Bundles number", String.valueOf(connectorSyncopeOperations.getBundles().size()));
+ connectorResultManager.printDetails(details);
+ } else {
+ connectorResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
index 4ff92ed..be44465 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.connector;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.to.ConnBundleTO;
@@ -74,8 +75,6 @@ public class ConnectorResultManager extends CommonsResultManager {
System.out.println(" display name: " + connBundleTO.getDisplayName());
System.out.println(" location: " + connBundleTO.getLocation());
System.out.println(" version: " + connBundleTO.getVersion());
- System.out.println(" PROPERTIES:");
- printConfPropSchema(connBundleTO.getProperties());
}
}
@@ -95,4 +94,8 @@ public class ConnectorResultManager extends CommonsResultManager {
printConfiguration(connConfPropertys);
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("connectors details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
index adda76b..d27c613 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
@@ -31,6 +31,7 @@ public class DomainCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: domain [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list \n"
+ " --delete \n"
+ " Syntax: --delete {DOMAIN-NAME} {DOMAIN-NAME} [...]\n";
@@ -41,6 +42,9 @@ public class DomainCommand extends AbstractCommand {
input.setOption(Options.HELP.getOptionName());
}
switch (Options.fromName(input.getOption())) {
+ case DETAILS:
+ new DomainDetails(input).details();
+ break;
case LIST:
new DomainList(input).list();
break;
@@ -63,6 +67,7 @@ public class DomainCommand extends AbstractCommand {
private enum Options {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list"),
DELETE("--delete");
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java
new file mode 100644
index 0000000..a4808bb
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java
@@ -0,0 +1,50 @@
+/*
+ * 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.cli.commands.domain;
+
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class DomainDetails extends AbstractDomainCommand {
+
+ private static final String LIST_HELP_MESSAGE = "domain --details";
+
+ private final Input input;
+
+ public DomainDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ details.put("Total number", String.valueOf(domainSyncopeOperations.list().size()));
+ domainResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ domainResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ domainResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
index d0b28ed..ca21592 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.domain;
import java.util.List;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.to.DomainTO;
@@ -34,4 +35,8 @@ public class DomainResultManager extends CommonsResultManager {
System.out.println(" > DOIMAIN NAME: " + domainTO.getKey());
System.out.println(" chiper algorithm: " + domainTO.getAdminCipherAlgorithm());
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("domains details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
index 4d2a55e..5b0ecc8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
@@ -31,6 +31,7 @@ public class LoggerCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: logger [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list \n"
+ " --read \n"
+ " Syntax: --read {LOG-NAME} {LOG-NAME} [...]\n"
@@ -50,6 +51,9 @@ public class LoggerCommand extends AbstractCommand {
}
switch (LoggerOptions.fromName(input.getOption())) {
+ case DETAILS:
+ new LoggerDetails(input).details();
+ break;
case LIST:
new LoggerList(input).list();
break;
@@ -84,6 +88,7 @@ public class LoggerCommand extends AbstractCommand {
private enum LoggerOptions {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list"),
READ("--read"),
UPDATE("--update"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java
new file mode 100644
index 0000000..b86aeb9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java
@@ -0,0 +1,93 @@
+/*
+ * 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.cli.commands.logger;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.LoggerTO;
+
+public class LoggerDetails extends AbstractLoggerCommand {
+
+ private static final String LIST_HELP_MESSAGE = "logger --details";
+
+ private final Input input;
+
+ public LoggerDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<LoggerTO> loggerTOs = loggerSyncopeOperations.list();
+ int debugLevel = 0;
+ int errorLevel = 0;
+ int fatalLevel = 0;
+ int infoLevel = 0;
+ int offLevel = 0;
+ int traceLevel = 0;
+ int warnLevel = 0;
+ for (final LoggerTO loggerTO : loggerTOs) {
+ switch (loggerTO.getLevel()) {
+ case DEBUG:
+ debugLevel++;
+ break;
+ case ERROR:
+ errorLevel++;
+ break;
+ case FATAL:
+ fatalLevel++;
+ break;
+ case INFO:
+ infoLevel++;
+ break;
+ case OFF:
+ offLevel++;
+ break;
+ case TRACE:
+ traceLevel++;
+ break;
+ case WARN:
+ warnLevel++;
+ break;
+ default:
+ break;
+ }
+ }
+ details.put("Total number", String.valueOf(loggerTOs.size()));
+ details.put("Set to DEBUG", String.valueOf(debugLevel));
+ details.put("Set to ERROR", String.valueOf(errorLevel));
+ details.put("Set to FATAL", String.valueOf(fatalLevel));
+ details.put("Set to INFO", String.valueOf(infoLevel));
+ details.put("Set to OFF", String.valueOf(offLevel));
+ details.put("Set to TRACE", String.valueOf(traceLevel));
+ details.put("Set to WARN", String.valueOf(warnLevel));
+ loggerResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ loggerResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ loggerResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
index d6f759c..d78f5db 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
@@ -20,6 +20,7 @@ package org.apache.syncope.client.cli.commands.logger;
import java.util.Arrays;
import java.util.LinkedList;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.client.cli.view.Table;
import org.apache.syncope.common.lib.to.LoggerTO;
@@ -57,4 +58,8 @@ public class LoggerResultManager extends CommonsResultManager {
}
tableBuilder.build().print();
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("loggers details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
index 9341ae2..365c02b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.cli.commands.notification;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.NotificationTO;
public class NotificationList extends AbstractNotificationCommand {
@@ -35,9 +34,7 @@ public class NotificationList extends AbstractNotificationCommand {
public void list() {
if (input.parameterNumber() == 0) {
try {
- for (final NotificationTO notificationTO : notificationSyncopeOperations.list()) {
- System.out.println(notificationTO);
- }
+ notificationResultManager.printNotifications(notificationSyncopeOperations.list());
} catch (final SyncopeClientException ex) {
notificationResultManager.genericError(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
index d493fa5..efd2d7c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
@@ -36,7 +36,7 @@ public class NotificationRead extends AbstractNotificationCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- System.out.println(notificationSyncopeOperations.read(parameter));
+ notificationResultManager.printNotification(notificationSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
notificationResultManager.notBooleanDeletedError("notification", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
index d16d88b..45c4223 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
@@ -18,8 +18,31 @@
*/
package org.apache.syncope.client.cli.commands.notification;
+import java.util.List;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.NotificationTO;
public class NotificationResultManager extends CommonsResultManager {
+ public void printNotifications(final List<NotificationTO> notificationTOs) {
+ for (final NotificationTO notificationTO : notificationTOs) {
+ printNotification(notificationTO);
+ }
+ }
+
+ public void printNotification(final NotificationTO notificationTO) {
+ System.out.println(" > NOTIFICATION ID: " + notificationTO.getKey());
+ System.out.println(" events: " + notificationTO.getEvents());
+ System.out.println(" sender: " + notificationTO.getSender());
+ System.out.println(" subject: " + notificationTO.getSubject());
+ System.out.println(" recipients: " + notificationTO.getRecipients());
+ System.out.println(" recipient attribute name: " + notificationTO.getRecipientAttrName());
+ System.out.println(" template: " + notificationTO.getTemplate());
+ System.out.println(" abouts: " + notificationTO.getAbouts());
+ System.out.println(" recipient attribute types: " + notificationTO.getRecipientAttrType());
+ System.out.println(" static recipient: " + notificationTO.getStaticRecipients());
+ System.out.println(" trace level: " + notificationTO.getTraceLevel());
+ System.out.println(" active: " + notificationTO.isActive());
+ System.out.println(" self as recipient: " + notificationTO.isSelfAsRecipient());
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
index f665113..a0a697d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
@@ -31,6 +31,7 @@ public class PolicyCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: policy [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list-policy \n"
+ " Syntax: --list-policy {POLICY-TYPE} \n"
+ " Policy type: ACCOUNT / PASSWORD / SYNC / PUSH\n"
@@ -46,6 +47,9 @@ public class PolicyCommand extends AbstractCommand {
}
switch (Options.fromName(input.getOption())) {
+ case DETAILS:
+ new PolicyDetails(input).details();
+ break;
case LIST_POLICY:
new PolicyList(input).list();
break;
@@ -71,6 +75,7 @@ public class PolicyCommand extends AbstractCommand {
private enum Options {
HELP("--help"),
+ DETAILS("--details"),
LIST_POLICY("--list-policy"),
READ("--read"),
DELETE("--delete");
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java
new file mode 100644
index 0000000..946fb4e
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java
@@ -0,0 +1,60 @@
+/*
+ * 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.cli.commands.policy;
+
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.types.PolicyType;
+
+public class PolicyDetails extends AbstractPolicyCommand {
+
+ private static final String DETAILS_HELP_MESSAGE = "policy --details";
+
+ private final Input input;
+
+ public PolicyDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final int accountPolicySize = policySyncopeOperations.list(PolicyType.ACCOUNT).size();
+ final int passwordPolicySize = policySyncopeOperations.list(PolicyType.PASSWORD).size();
+ final int syncPolicySize = policySyncopeOperations.list(PolicyType.SYNC).size();
+ final int pushPolicySize = policySyncopeOperations.list(PolicyType.PUSH).size();
+ details.put("total number", String.valueOf(accountPolicySize
+ + passwordPolicySize
+ + syncPolicySize
+ + pushPolicySize));
+ details.put("account policies", String.valueOf(accountPolicySize));
+ details.put("password policies", String.valueOf(passwordPolicySize));
+ details.put("sync policies", String.valueOf(syncPolicySize));
+ details.put("push policies", String.valueOf(pushPolicySize));
+ policyResultManager.printDetails(details);
+ } catch (final Exception ex) {
+ policyResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ policyResultManager.commandOptionError(DETAILS_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
index d23fa11..0cd8ea4 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
@@ -37,7 +37,6 @@ public class PolicyList extends AbstractPolicyCommand {
}
public void list() {
-
if (input.parameterNumber() == 1) {
try {
final PolicyType policyType = PolicyType.valueOf(input.firstParameter());
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
index 86b5d13..d130f73 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.policy;
import java.util.LinkedList;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
import org.apache.syncope.common.lib.policy.AccountPolicyTO;
@@ -120,4 +121,8 @@ public class PolicyResultManager extends CommonsResultManager {
}
System.out.println("");
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("policies details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
index 95b8ec4..7e38415 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
@@ -31,6 +31,7 @@ public class RealmCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: realm [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list \n";
@Override
@@ -39,6 +40,9 @@ public class RealmCommand extends AbstractCommand {
input.setOption(Options.HELP.getOptionName());
}
switch (Options.fromName(input.getOption())) {
+ case DETAILS:
+ new RealmDetails(input).details();
+ break;
case LIST:
new RealmList(input).list();
break;
@@ -58,6 +62,7 @@ public class RealmCommand extends AbstractCommand {
private enum Options {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list");
private final String optionName;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java
new file mode 100644
index 0000000..b68a7b4
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java
@@ -0,0 +1,49 @@
+/*
+ * 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.cli.commands.realm;
+
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class RealmDetails extends AbstractRealmCommand {
+
+ private static final String DETAILS_HELP_MESSAGE = "realm --details";
+
+ private final Input input;
+
+ public RealmDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ details.put("Total number", String.valueOf(realmSyncopeOperations.list().size()));
+ realmResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ realmResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ realmResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
index bbb46d9..f6776b3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.realm;
import java.util.List;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.to.RealmTO;
@@ -36,4 +37,8 @@ public class RealmResultManager extends CommonsResultManager {
System.out.println(" password policy id: " + realmTO.getPasswordPolicy());
}
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("realms details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
index ac67fcf..c6304ac 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
@@ -31,6 +31,7 @@ public class ReportCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: report [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details\n"
+ " --list \n"
+ " --list-jobs \n"
+ " --read \n"
@@ -57,6 +58,9 @@ public class ReportCommand extends AbstractCommand {
case LIST:
new ReportList(input).list();
break;
+ case DETAILS:
+ new ReportDetails(input).details();
+ break;
case LIST_JOBS:
new ReportListJobs(input).list();
break;
@@ -94,6 +98,7 @@ public class ReportCommand extends AbstractCommand {
private enum Options {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list"),
LIST_JOBS("--list-jobs"),
READ("--read"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDetails.java
new file mode 100644
index 0000000..05fb901
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDetails.java
@@ -0,0 +1,59 @@
+/*
+ * 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.cli.commands.report;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.ReportTO;
+
+public class ReportDetails extends AbstractReportCommand {
+
+ private static final String LIST_HELP_MESSAGE = "report --details";
+
+ private final Input input;
+
+ public ReportDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<ReportTO> reportTOs = reportSyncopeOperations.list();
+ int withoutExecutions = 0;
+ for (final ReportTO reportTO : reportTOs) {
+ if (reportTO.getExecutions().isEmpty()) {
+ withoutExecutions++;
+ }
+ }
+ details.put("Total numbers", String.valueOf(reportTOs.size()));
+ details.put("Never executed", String.valueOf(withoutExecutions));
+ reportResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ reportResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ reportResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
index abeaf4e..1aced78 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
@@ -34,9 +34,9 @@ public class ReportList extends AbstractReportCommand {
public void list() {
if (input.parameterNumber() == 0) {
try {
- reportResultManager.fromValueToView(reportSyncopeOperations.list());
+ reportResultManager.printReports(reportSyncopeOperations.list());
} catch (final SyncopeClientException ex) {
- reportResultManager.genericMessage(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
} else {
reportResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
index acd5da0..bf21e65 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
@@ -51,7 +51,7 @@ public class ReportRead extends AbstractReportCommand {
}
}
}
- reportResultManager.fromValueToView(reportTOs);
+ reportResultManager.printReports(reportTOs);
} else {
reportResultManager.commandOptionError(READ_HELP_MESSAGE);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportResultManager.java
index bafdffe..c93de75 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.report;
import java.util.List;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.report.AbstractReportletConf;
import org.apache.syncope.common.lib.report.UserReportletConf;
@@ -27,7 +28,7 @@ import org.apache.syncope.common.lib.to.ReportTO;
public class ReportResultManager extends CommonsResultManager {
- public void fromValueToView(final List<ReportTO> reportTOs) {
+ public void printReports(final List<ReportTO> reportTOs) {
for (final ReportTO reportTO : reportTOs) {
printReport(reportTO);
}
@@ -38,8 +39,6 @@ public class ReportResultManager extends CommonsResultManager {
System.out.println(" name: " + reportTO.getName());
System.out.println(" cron expression: " + reportTO.getCronExpression());
System.out.println(" latest execution status: " + reportTO.getLatestExecStatus());
- System.out.println(" last execution: " + reportTO.getLastExec());
- System.out.println(" next execution: " + reportTO.getNextExec());
System.out.println(" start date: " + reportTO.getStartDate());
System.out.println(" end date: " + reportTO.getEndDate());
System.out.println(" CONF:");
@@ -73,4 +72,8 @@ public class ReportResultManager extends CommonsResultManager {
System.out.println(" report id: " + reportExecTO.getReport());
}
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("reports details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
index 185cd99..f2f8145 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
@@ -31,6 +31,7 @@ public class ResourceCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: resource [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list \n"
+ " --read \n"
+ " Syntax: --read {CONNECTOR-ID} {CONNECTOR-ID} [...]\n"
@@ -44,6 +45,9 @@ public class ResourceCommand extends AbstractCommand {
}
switch (ResourceOptions.fromName(input.getOption())) {
+ case DETAILS:
+ new ResourceDetails(input).details();
+ break;
case LIST:
new ResourceList(input).list();
break;
@@ -69,6 +73,7 @@ public class ResourceCommand extends AbstractCommand {
private enum ResourceOptions {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list"),
READ("--read"),
DELETE("--delete");
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDetails.java
new file mode 100644
index 0000000..25d3de7
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDetails.java
@@ -0,0 +1,52 @@
+/*
+ * 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.cli.commands.resource;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.ResourceTO;
+
+public class ResourceDetails extends AbstractResourceCommand {
+
+ private static final String DETAILS_HELP_MESSAGE = "resource --details";
+
+ private final Input input;
+
+ public ResourceDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<ResourceTO> resourceTOs = resourceSyncopeOperations.list();
+ details.put("Total numbers", String.valueOf(resourceTOs.size()));
+ resourceResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ resourceResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ resourceResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
index 488f574..3ce923d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.resource;
import java.util.List;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
@@ -53,6 +54,9 @@ public class ResourceResultManager extends CommonsResultManager {
System.out.println(" delete trace level: " + resourceTO.getDeleteTraceLevel());
System.out.println(" update trace level: " + resourceTO.getUpdateTraceLevel());
System.out.println(" sync trace level: " + resourceTO.getSyncTraceLevel());
+ System.out.println(" enforce mandatory condition: " + resourceTO.isEnforceMandatoryCondition());
+ System.out.println(" override capabilities: " + resourceTO.isOverrideCapabilities());
+ System.out.println(" random password if not provided: " + resourceTO.isRandomPwdIfNotProvided());
System.out.println("");
}
@@ -89,4 +93,8 @@ public class ResourceResultManager extends CommonsResultManager {
System.out.println("");
}
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("resources details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
index 63c9f09..1142a49 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
@@ -31,6 +31,7 @@ public class RoleCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: role [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list \n"
+ " --read \n"
+ " Syntax: --read {ROLE-ID} {ROLE-ID} [...]"
@@ -44,6 +45,9 @@ public class RoleCommand extends AbstractCommand {
}
switch (RoleOptions.fromName(input.getOption())) {
+ case DETAILS:
+ new RoleDetails(input).details();
+ break;
case LIST:
new RoleList(input).list();
break;
@@ -69,6 +73,7 @@ public class RoleCommand extends AbstractCommand {
private enum RoleOptions {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list"),
READ("--read"),
DELETE("--delete");
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDetails.java
new file mode 100644
index 0000000..879d449
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDetails.java
@@ -0,0 +1,59 @@
+/*
+ * 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.cli.commands.role;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.RoleTO;
+
+public class RoleDetails extends AbstractRoleCommand {
+
+ private static final String DETAILS_HELP_MESSAGE = "role --details";
+
+ private final Input input;
+
+ public RoleDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<RoleTO> roleTOs = roleSyncopeOperations.list();
+ int withoutEntitlements = 0;
+ for (final RoleTO roleTO : roleTOs) {
+ if (roleTO.getEntitlements() == null || roleTO.getEntitlements().isEmpty()) {
+ withoutEntitlements++;
+ }
+ }
+ details.put("Total number", String.valueOf(roleTOs.size()));
+ details.put("Without entitlements", String.valueOf(withoutEntitlements));
+ roleResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ roleResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ roleResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
index a672d53..aa3117c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.cli.commands.role;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.common.lib.to.RoleTO;
@@ -54,4 +55,8 @@ public class RoleResultManager extends CommonsResultManager {
System.out.println(" - " + entitlement);
}
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("Roles details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
index c0d3976..e58c358 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
@@ -31,6 +31,7 @@ public class SchemaCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: schema [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details \n"
+ " --list-all\n"
+ " --list-plain\n"
+ " --list-derived\n"
@@ -47,6 +48,9 @@ public class SchemaCommand extends AbstractCommand {
}
switch (Options.fromName(input.getOption())) {
+ case DETAILS:
+ new SchemaDetails(input).details();
+ break;
case LIST:
new SchemaList(input).list();
break;
@@ -84,6 +88,7 @@ public class SchemaCommand extends AbstractCommand {
private enum Options {
HELP("--help"),
+ DETAILS("--details"),
LIST("--list"),
LIST_ALL("--list-all"),
LIST_PLAIN("--list-plain"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDetails.java
new file mode 100644
index 0000000..7a76836
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDetails.java
@@ -0,0 +1,58 @@
+/*
+ * 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.cli.commands.schema;
+
+import java.util.Map;
+import javax.xml.ws.WebServiceException;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class SchemaDetails extends AbstractSchemaCommand {
+
+ private static final String DETAILS_HELP_MESSAGE = "schema --details";
+
+ private final Input input;
+
+ public SchemaDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final int plainSchemaSize = schemaSyncopeOperations.listPlain().size();
+ final int derivedSchemaSize = schemaSyncopeOperations.listDerived().size();
+ final int virtualSchemaSize = schemaSyncopeOperations.listVirtual().size();
+ details.put("total number", String.valueOf(plainSchemaSize
+ + derivedSchemaSize
+ + virtualSchemaSize));
+ details.put("plain schema", String.valueOf(plainSchemaSize));
+ details.put("derived schema", String.valueOf(derivedSchemaSize));
+ details.put("virtual schema", String.valueOf(virtualSchemaSize));
+ schemaResultManager.printDetails(details);
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ schemaResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ schemaResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
index 5963eb8..4618375 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaResultManager.java
@@ -20,6 +20,7 @@ package org.apache.syncope.client.cli.commands.schema;
import java.util.Arrays;
import java.util.LinkedList;
+import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.client.cli.view.Table;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
@@ -93,4 +94,8 @@ public class SchemaResultManager extends CommonsResultManager {
}
tableBuilder.build().print();
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("Schemas details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
index f95d69f..e7b5ce5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
@@ -31,6 +31,7 @@ public class TaskCommand extends AbstractCommand {
private static final String HELP_MESSAGE = "Usage: task [options]\n"
+ " Options:\n"
+ " --help \n"
+ + " --details\n"
+ " --list-task \n"
+ " Syntax: --list-task {TASK-TYPE} \n"
+ " Task type: NOTIFICATION / PROPAGATION / PUSH / SCHEDULED / SYNCHRONIZATION\n"
@@ -55,6 +56,9 @@ public class TaskCommand extends AbstractCommand {
}
switch (Options.fromName(input.getOption())) {
+ case DETAILS:
+ new TaskDetails(input).details();
+ break;
case LIST_TASK:
new TaskList(input).list();
break;
@@ -95,6 +99,7 @@ public class TaskCommand extends AbstractCommand {
private enum Options {
HELP("--help"),
+ DETAILS("--details"),
LIST_TASK("--list-task"),
LIST_RUNNING_JOBS("--list-running-jobs"),
LIST_SCHEDULED_JOBS("--list-scheduled-jobs"),
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
new file mode 100644
index 0000000..0eba187
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDetails.java
@@ -0,0 +1,137 @@
+/*
+ * 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.cli.commands.task;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.NotificationTaskTO;
+import org.apache.syncope.common.lib.to.PropagationTaskTO;
+import org.apache.syncope.common.lib.to.PushTaskTO;
+import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.SyncTaskTO;
+import org.apache.syncope.common.lib.to.TaskExecTO;
+import org.apache.syncope.common.lib.types.TaskType;
+
+public class TaskDetails extends AbstractTaskCommand {
+
+ private static final String DETAILS_HELP_MESSAGE = "task --details";
+
+ private final Input input;
+
+ public TaskDetails(final Input input) {
+ this.input = input;
+ }
+
+ public void details() {
+ if (input.parameterNumber() == 0) {
+ try {
+ final Map<String, String> details = new LinkedMap<>();
+ final List<AbstractTaskTO> notificationTaskTOs = taskSyncopeOperations.list(TaskType.NOTIFICATION);
+ final List<AbstractTaskTO> propagationTaskTOs = taskSyncopeOperations.list(TaskType.PROPAGATION);
+ final List<AbstractTaskTO> pushTaskTOs = taskSyncopeOperations.list(TaskType.PUSH);
+ final List<AbstractTaskTO> scheduledTaskTOs = taskSyncopeOperations.list(TaskType.SCHEDULED);
+ final List<AbstractTaskTO> syncTaskTOs = taskSyncopeOperations.list(TaskType.SYNCHRONIZATION);
+ final List<TaskExecTO> runningTOs = taskSyncopeOperations.listRunningJobs();
+ final List<TaskExecTO> scheduledTOs = taskSyncopeOperations.listScheduledJobs();
+ final int notificationTaskSize = notificationTaskTOs.size();
+ int notificationNotExecuted = 0;
+ final int propagationTaskSize = propagationTaskTOs.size();
+ int propagationNotExecuted = 0;
+ final int pushTaskSize = pushTaskTOs.size();
+ int pushNotExecuted = 0;
+ final int scheduledTaskSize = scheduledTaskTOs.size();
+ int scheduledNotExecuted = 0;
+ final int syncTaskSize = syncTaskTOs.size();
+ int syncNotExecuted = 0;
+ int syncFull = 0;
+ final int runningJobsSize = runningTOs.size();
+ final int scheduledJobsSize = scheduledTOs.size();
+
+ for (final AbstractTaskTO notificationTaskTO : notificationTaskTOs) {
+ if (!((NotificationTaskTO) notificationTaskTO).isExecuted()) {
+ notificationNotExecuted++;
+ }
+ }
+
+ for (final AbstractTaskTO propagationTaskTO : propagationTaskTOs) {
+ if (((PropagationTaskTO) propagationTaskTO).getExecutions() == null
+ || ((PropagationTaskTO) propagationTaskTO).getExecutions().isEmpty()) {
+ propagationNotExecuted++;
+ }
+ }
+
+ for (final AbstractTaskTO pushTaskTO : pushTaskTOs) {
+ if (((PushTaskTO) pushTaskTO).getExecutions() == null
+ || ((PushTaskTO) pushTaskTO).getExecutions().isEmpty()) {
+ pushNotExecuted++;
+ }
+ }
+
+ for (final AbstractTaskTO scheduledTaskTO : scheduledTaskTOs) {
+ if (((SchedTaskTO) scheduledTaskTO).getExecutions() == null
+ || ((SchedTaskTO) scheduledTaskTO).getExecutions().isEmpty()) {
+ scheduledNotExecuted++;
+ }
+ }
+
+ for (final AbstractTaskTO syncTaskTO : syncTaskTOs) {
+ if (((SyncTaskTO) syncTaskTO).getExecutions() == null
+ || ((SyncTaskTO) syncTaskTO).getExecutions().isEmpty()) {
+ syncNotExecuted++;
+ }
+ if (((SyncTaskTO) syncTaskTO).isFullReconciliation()) {
+ syncFull++;
+ }
+ }
+
+ details.put("total number", String.valueOf(notificationTaskSize
+ + propagationTaskSize
+ + pushTaskSize
+ + scheduledTaskSize
+ + syncTaskSize));
+ details.put("notification tasks", String.valueOf(notificationTaskSize));
+ details.put("notification tasks not executed", String.valueOf(notificationNotExecuted));
+ details.put("propagation tasks", String.valueOf(propagationTaskSize));
+ details.put("propagation tasks not executed", String.valueOf(propagationNotExecuted));
+ details.put("push tasks", String.valueOf(pushTaskSize));
+ details.put("push tasks not executed", String.valueOf(pushNotExecuted));
+ details.put("scheduled tasks", String.valueOf(scheduledTaskSize));
+ details.put("scheduled tasks not executed", String.valueOf(scheduledNotExecuted));
+ details.put("synchronization tasks", String.valueOf(syncTaskSize));
+ details.put("synchronization tasks not executed", String.valueOf(syncNotExecuted));
+ details.put("synchronization tasks with full reconciliation", String.valueOf(syncFull));
+ details.put("running jobs", String.valueOf(runningJobsSize));
+ details.put("scheduled jobs", String.valueOf(scheduledJobsSize));
+ taskResultManager.printDetails(details);
+ } catch (final SyncopeClientException ex) {
+ taskResultManager.genericError(ex.getMessage());
+ } catch (final IllegalArgumentException ex) {
+ taskResultManager.typeNotValidError(
+ "task", input.firstParameter(), CommandUtils.fromEnumToArray(TaskType.class));
+ }
+ } else {
+ taskResultManager.commandOptionError(DETAILS_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
index e01141a..2ac538e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
@@ -24,7 +24,6 @@ import org.apache.syncope.client.cli.util.CommandUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
import org.apache.syncope.common.lib.types.TaskType;
-import org.apache.syncope.common.rest.api.beans.TaskQuery;
public class TaskList extends AbstractTaskCommand {
@@ -42,7 +41,7 @@ public class TaskList extends AbstractTaskCommand {
try {
final TaskType taskType = TaskType.valueOf(input.firstParameter());
final LinkedList<AbstractTaskTO> taskTOs = new LinkedList<>();
- for (final AbstractTaskTO taskTO : taskSyncopeOperations.list(taskType, new TaskQuery()).getResult()) {
+ for (final AbstractTaskTO taskTO : taskSyncopeOperations.list(taskType)) {
taskTOs.add(taskTO);
}
taskResultManager.fromList(taskType, taskTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
index ad8b658..8611305 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
@@ -144,7 +144,6 @@ public class TaskResultManager extends CommonsResultManager {
System.out.println(" matching rule: " + pushTaskTO.getMatchingRule());
System.out.println(" not matching rule: " + pushTaskTO.getUnmatchingRule());
printTaskExecTO(pushTaskTO.getExecutions());
-
System.out.println("");
}
@@ -176,19 +175,12 @@ public class TaskResultManager extends CommonsResultManager {
System.out.println(" description: " + syncTaskTO.getDescription());
System.out.println(" is full reconciliation: "
+ syncTaskTO.isFullReconciliation());
- System.out.println(" is perform create: " + syncTaskTO.isPerformCreate());
- System.out.println(" is perform delete: " + syncTaskTO.isPerformDelete());
- System.out.println(" is perform update: " + syncTaskTO.isPerformUpdate());
- System.out.println(" is sync status: " + syncTaskTO.isSyncStatus());
- System.out.println(" templates:");
- for (Map.Entry<String, AnyTO> entrySet : syncTaskTO.getTemplates().entrySet()) {
- final String key = entrySet.getKey();
- final AnyTO value = entrySet.getValue();
- System.out.println(" " + key + " key: " + value.getKey()
- + " of realm" + value.getRealm()
- + " on resource " + value.getResources());
-
- }
+ System.out.println(" perform create: " + syncTaskTO.isPerformCreate());
+ System.out.println(" perform delete: " + syncTaskTO.isPerformDelete());
+ System.out.println(" perform update: " + syncTaskTO.isPerformUpdate());
+ System.out.println(" sync status: " + syncTaskTO.isSyncStatus());
+ System.out.println(" TEMPLATES:");
+ printTemplates(syncTaskTO.getTemplates());
System.out.println(" start date: " + syncTaskTO.getStartDate());
System.out.println(" end date: " + syncTaskTO.getEndDate());
System.out.println(" next execution: " + syncTaskTO.getNextExec());
@@ -204,6 +196,17 @@ public class TaskResultManager extends CommonsResultManager {
System.out.println("");
}
+ private void printTemplates(final Map<String, AnyTO> templates) {
+ for (final Map.Entry<String, AnyTO> entrySet : templates.entrySet()) {
+ final String key = entrySet.getKey();
+ final AnyTO value = entrySet.getValue();
+ System.out.println(" " + key + " key: " + value.getKey()
+ + " of realm" + value.getRealm()
+ + " on resource " + value.getResources());
+
+ }
+ }
+
public void printTaskExecTO(final List<TaskExecTO> taskExecTOs) {
for (final TaskExecTO taskExecTO : taskExecTOs) {
System.out.println(" EXECUTIONS: ");
@@ -219,4 +222,8 @@ public class TaskResultManager extends CommonsResultManager {
System.out.println("");
}
}
+
+ public void printDetails(final Map<String, String> details) {
+ printDetails("tasks details", details);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
index 6b819e9..756efa6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.cli.commands.task;
import java.util.List;
import org.apache.syncope.client.cli.SyncopeServices;
import org.apache.syncope.common.lib.to.AbstractTaskTO;
-import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.TaskExecTO;
import org.apache.syncope.common.lib.types.JobStatusType;
import org.apache.syncope.common.lib.types.TaskType;
@@ -48,8 +47,8 @@ public class TaskSyncopeOperations {
taskService.read(Long.valueOf(taskId));
}
- public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType type, final TaskQuery query) {
- return taskService.list(type, query);
+ public List<AbstractTaskTO> list(final TaskType type) {
+ return taskService.list(type, new TaskQuery()).getResult();
}
public TaskExecTO readExecution(final String executionId) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/d43268c1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
index f34d1d0..3595508 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
@@ -32,7 +32,7 @@ public class UserCommand extends AbstractCommand {
+ " Options:\n"
+ " --help \n"
+ " --list \n"
- + " --count \n"
+ + " --details \n"
+ " --get-user-key\n"
+ " Syntax: --get-user-key {USER-ID} {USER-ID} [...]\n"
+ " --get-username\n"
@@ -55,8 +55,8 @@ public class UserCommand extends AbstractCommand {
}
switch (UserOptions.fromName(input.getOption())) {
- case COUNT:
- new UserCount(input).count();
+ case DETAILS:
+ new UserDetails(input).details();
break;
case LIST:
new UserList(input).list();
@@ -98,7 +98,7 @@ public class UserCommand extends AbstractCommand {
private enum UserOptions {
HELP("--help"),
- COUNT("--count"),
+ DETAILS("--details"),
LIST("--list"),
GET_BY_KEY("--get-user-key"),
GET_BY_USERNAME("--get-username"),
[49/50] [abbrv] syncope git commit: provides wizard to create users,
groups and any objects + several changes merged from master
Posted by fm...@apache.org.
provides wizard to create users, groups and any objects + several changes merged from master
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/047ac019
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/047ac019
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/047ac019
Branch: refs/heads/SYNCOPE-156
Commit: 047ac0190bf15aff81fee2d9538bd68a64305d15
Parents: 4c30ca7
Author: fmartelli <fa...@gmail.com>
Authored: Fri Oct 30 12:32:48 2015 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Oct 30 12:32:48 2015 +0100
----------------------------------------------------------------------
.../schema/SchemaSyncopeOperations.java | 8 +-
.../client/console/PreferenceManager.java | 7 +-
.../console/pages/ProvisioningModalPage.java | 4 +-
.../client/console/pages/ResultStatusModal.java | 31 +-
.../console/panels/AbstractModalPanel.java | 4 +-
.../panels/AbstractSearchResultPanel.java | 78 ++++-
.../console/panels/AjaxDataTablePanel.java | 2 +-
.../console/panels/AnySearchResultPanel.java | 57 +++-
.../console/panels/ConnectorConfPanel.java | 14 +-
.../client/console/panels/GroupModalPanel.java | 119 -------
.../client/console/panels/GroupPanel.java | 75 ----
.../console/panels/GroupSearchResultPanel.java | 53 ++-
.../client/console/panels/ListViewPanel.java | 157 ++-------
.../client/console/panels/ModalPanel.java | 30 ++
.../syncope/client/console/panels/Realm.java | 58 +++-
.../console/panels/ResourceConnConfPanel.java | 12 +-
.../console/panels/ResourceDetailsPanel.java | 6 -
.../console/panels/UserSearchResultPanel.java | 60 +++-
.../client/console/rest/AnyTypeRestClient.java | 37 +-
.../console/rest/ConfigurationRestClient.java | 4 +-
.../client/console/rest/GroupRestClient.java | 15 +-
.../client/console/rest/SchemaRestClient.java | 31 +-
.../client/console/rest/UserRestClient.java | 14 +-
.../markup/html/ClearIndicatingAjaxLink.java | 2 +
.../markup/html/bootstrap/dialog/BaseModal.java | 18 +-
.../markup/html/form/ActionLinksPanel.java | 2 +
.../markup/html/form/BinaryFieldPanel.java | 7 +-
.../markup/html/form/SpinnerFieldPanel.java | 4 +-
.../client/console/wizards/AjaxWizard.java | 42 ++-
.../console/wizards/AjaxWizardBuilder.java | 21 +-
.../console/wizards/AjaxWizardButtonBar.java | 1 +
.../client/console/wizards/WizardMgtPanel.java | 216 ++++++++++++
.../wizards/any/AnyObjectWizardBuilder.java | 143 ++++++++
.../console/wizards/any/AnyWizardBuilder.java | 85 +++++
.../client/console/wizards/any/DerAttrs.java | 137 ++++++++
.../console/wizards/any/GroupDetails.java | 293 ++++++++++++++++
.../console/wizards/any/GroupWizardBuilder.java | 67 ++++
.../client/console/wizards/any/PlainAttrs.java | 339 +++++++++++++++++++
.../client/console/wizards/any/UserDetails.java | 104 ++++++
.../console/wizards/any/UserWizardBuilder.java | 73 ++++
.../client/console/wizards/any/VirAttrs.java | 141 ++++++++
.../provision/ProvisionWizardBuilder.java | 9 +-
.../META-INF/resources/css/syncopeConsole.css | 15 +
.../panels/AbstractSearchResultPanel.html | 10 +-
.../client/console/panels/GroupModalPanel.html | 52 ---
.../console/panels/GroupModalPanel.properties | 48 ---
.../panels/GroupModalPanel_it.properties | 50 ---
.../panels/GroupModalPanel_pt_BR.properties | 48 ---
.../client/console/panels/ListViewPanel.html | 22 +-
.../console/panels/ResourceDetailsPanel.html | 4 -
.../console/panels/ResourceModal.properties | 1 -
.../console/panels/ResourceModalPage.html | 56 ---
.../console/panels/ResourceModalPage.properties | 60 ----
.../console/panels/ResourceModal_it.properties | 1 -
.../panels/ResourceModal_pt_BR.properties | 1 -
.../console/wizards/AjaxWizard.properties | 18 +
.../console/wizards/AjaxWizard_it.properties | 18 +
.../console/wizards/AjaxWizard_pt_BR.properties | 18 +
.../client/console/wizards/WizardMgtPanel.html | 45 +++
.../client/console/wizards/any/DerAttrs.html | 42 +++
.../console/wizards/any/DerAttrs.properties | 18 +
.../console/wizards/any/DerAttrs_it.properties | 18 +
.../wizards/any/DerAttrs_pt_BR.properties | 18 +
.../console/wizards/any/GroupDetails.html | 56 +++
.../console/wizards/any/GroupDetails.properties | 16 +
.../wizards/any/GroupDetails_it.properties | 16 +
.../wizards/any/GroupDetails_pt_BR.properties | 16 +
.../client/console/wizards/any/PlainAttrs.html | 40 +++
.../client/console/wizards/any/UserDetails.html | 59 ++++
.../console/wizards/any/UserDetails.properties | 19 ++
.../wizards/any/UserDetails_it.properties | 19 ++
.../wizards/any/UserDetails_pt_BR.properties | 19 ++
.../client/console/wizards/any/VirAttrs.html | 42 +++
.../console/wizards/any/VirAttrs.properties | 17 +
.../console/wizards/any/VirAttrs_it.properties | 17 +
.../wizards/any/VirAttrs_pt_BR.properties | 17 +
.../ProvisionWizardBuilder$ConnObjectLink.html | 26 +-
.../ProvisionWizardBuilder$Mapping.html | 11 +-
.../ProvisionWizardBuilder$ObjectType.html | 26 +-
client/enduser/pom.xml | 6 +-
.../common/rest/api/service/SchemaService.java | 9 +-
.../apache/syncope/core/logic/SchemaLogic.java | 17 +-
.../provisioning/java/ConnectorFacadeProxy.java | 4 +-
.../provisioning/java/sync/SyncJobDelegate.java | 9 +-
.../rest/cxf/service/SchemaServiceImpl.java | 4 +-
.../fit/core/reference/DerSchemaITCase.java | 2 +-
.../syncope/fit/core/reference/GroupITCase.java | 4 +-
.../fit/core/reference/MultitenancyITCase.java | 2 +-
.../fit/core/reference/PlainSchemaITCase.java | 56 +--
.../fit/core/reference/VirSchemaITCase.java | 2 +-
pom.xml | 6 +
91 files changed, 2763 insertions(+), 917 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
index c8f0a6d..c5e8097 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
@@ -33,19 +33,19 @@ public class SchemaSyncopeOperations {
}
public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType) {
- return schemaService.list(schemaType);
+ return schemaService.list(schemaType, null);
}
public <T extends AbstractSchemaTO> List<T> listVirtual() {
- return schemaService.list(SchemaType.VIRTUAL);
+ return schemaService.list(SchemaType.VIRTUAL, null);
}
public <T extends AbstractSchemaTO> List<T> listPlain() {
- return schemaService.list(SchemaType.PLAIN);
+ return schemaService.list(SchemaType.PLAIN, null);
}
public <T extends AbstractSchemaTO> List<T> listDerived() {
- return schemaService.list(SchemaType.DERIVED);
+ return schemaService.list(SchemaType.DERIVED, null);
}
public void delete(final SchemaType schemaType, final String schemaName) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java b/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
index c7baef2..03fab62 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java
@@ -21,6 +21,7 @@ package org.apache.syncope.client.console;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
+import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
@@ -37,7 +38,7 @@ import org.apache.wicket.util.crypt.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class PreferenceManager {
+public class PreferenceManager implements Serializable {
private static final Logger LOG = LoggerFactory.getLogger(PreferenceManager.class);
@@ -50,9 +51,11 @@ public class PreferenceManager {
private static final List<Integer> PAGINATOR_CHOICES = Arrays.asList(new Integer[] { 10, 25, 50 });
+ private static final long serialVersionUID = 1L;
+
private final ObjectMapper mapper;
- private final CookieUtils cookieUtils;
+ private final transient CookieUtils cookieUtils;
public PreferenceManager() {
this.mapper = new ObjectMapper();
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
index db85db1..4fb3630 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
@@ -241,8 +241,8 @@ public class ProvisioningModalPage<T extends AnyTO> extends AbstractStatusModalP
if (beans.isEmpty()) {
modal.close(target);
} else {
- BulkActionResult res = resourceRestClient.bulkAssociationAction(resourceTO.getKey(), anyTypeKind.name(),
- action, anyKeys);
+ BulkActionResult res = resourceRestClient.bulkAssociationAction(
+ resourceTO.getKey(), anyTypeKind.name(), action, anyKeys);
((BasePage) pageRef.getPage()).setModalResult(true);
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java
index 998ac60..b7c0b29 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java
@@ -43,6 +43,7 @@ import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.wicket.Component;
@@ -72,7 +73,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
private static final String IMG_PREFIX = "/img/statuses/";
- private final AnyTO subject;
+ private final ProvisioningResult<AnyTO> provResult;
private final Mode mode;
@@ -87,7 +88,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
private Mode mode;
- private AnyTO subject;
+ private ProvisioningResult<AnyTO> provResult;
private final BaseModal<T> modal;
@@ -96,8 +97,8 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
public Builder(
final BaseModal<T> modal,
final PageReference pageRef,
- final AnyTO attributable) {
- this.subject = attributable;
+ final ProvisioningResult<AnyTO> provResult) {
+ this.provResult = provResult;
this.modal = modal;
this.pageRef = pageRef;
}
@@ -119,7 +120,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
super(modal, pageRef);
- this.subject = builder.subject;
+ this.provResult = builder.provResult;
statusUtils = new StatusUtils(new UserRestClient());
if (builder.mode == null) {
this.mode = Mode.ADMIN;
@@ -145,14 +146,16 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
List<PropagationStatus> propagations = new ArrayList<PropagationStatus>();
propagations.add(syncope);
- propagations.addAll(subject.getPropagationStatusTOs());
+ propagations.addAll(provResult.getPropagationStatuses());
+
+ AnyTO any = provResult.getAny();
fragment.add(new Label("info",
- ((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null)
- ? ((UserTO) subject).getUsername()
- : ((subject instanceof GroupTO) && ((GroupTO) subject).getName() != null)
- ? ((GroupTO) subject).getName()
- : String.valueOf(subject.getKey())));
+ ((any instanceof UserTO) && ((UserTO) any).getUsername() != null)
+ ? ((UserTO) any).getUsername()
+ : ((any instanceof GroupTO) && ((GroupTO) any).getName() != null)
+ ? ((GroupTO) any).getName()
+ : String.valueOf(any.getKey())));
final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources",
propagations) {
@@ -267,7 +270,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
// sorted in reversed presentation order
final List<String> head = new ArrayList<String>();
- if (subject instanceof UserTO) {
+ if (provResult.getAny() instanceof UserTO) {
head.add(ConnIdSpecialAttributeName.PASSWORD);
head.add(ConnIdSpecialAttributeName.ENABLE);
}
@@ -286,7 +289,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
attributes.addAll(beforeAttrMap.keySet());
attributes.addAll(afterAttrMap.keySet());
- if (!(subject instanceof UserTO)) {
+ if (!(provResult.getAny() instanceof UserTO)) {
attributes.remove(ConnIdSpecialAttributeName.PASSWORD);
attributes.remove(ConnIdSpecialAttributeName.ENABLE);
}
@@ -382,7 +385,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel
final Image image;
final String alt, title;
switch (statusUtils.getStatusBean(
- subject, resourceName, objectTO, this.subject instanceof GroupTO).getStatus()) {
+ provResult.getAny(), resourceName, objectTO, this.provResult.getAny() instanceof GroupTO).getStatus()) {
case ACTIVE:
image = new Image("status",
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java
index 2c244b2..57d34aa 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java
@@ -30,7 +30,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class AbstractModalPanel extends Panel {
+public class AbstractModalPanel extends Panel implements ModalPanel {
private static final long serialVersionUID = 8611724965544132636L;
@@ -66,10 +66,12 @@ public class AbstractModalPanel extends Panel {
this.modal.close(target);
}
+ @Override
public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
modal.getFeedbackPanel().refresh(target);
}
+ @Override
public void onError(final AjaxRequestTarget target, final Form<?> form) {
modal.getFeedbackPanel().refresh(target);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
index 68bafbe..e6bd3ed 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.client.console.panels;
+import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.apache.syncope.client.console.PreferenceManager;
@@ -27,24 +28,23 @@ import org.apache.syncope.client.console.pages.AbstractBasePage;
import org.apache.syncope.client.console.rest.AbstractAnyRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.event.IEvent;
-import org.apache.wicket.event.IEventSource;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel implements IEventSource {
+public abstract class AbstractSearchResultPanel<T extends AnyTO> extends WizardMgtPanel<T> {
private static final long serialVersionUID = -9170191461250434024L;
@@ -94,12 +94,6 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i
private AnyDataProvider dataProvider;
/**
- * Modal window to be used for: user profile editing (Global visibility is required); attributes choosing to
- * display in tables; user status management.
- */
- protected final BaseModal<T> modal = new BaseModal<>("modal");
-
- /**
* Owner page.
*/
protected final AbstractBasePage page;
@@ -114,13 +108,16 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i
*/
private final String type;
- protected <T extends AnyTO> AbstractSearchResultPanel(final String id, final boolean filtered,
- final String fiql, final PageReference pageRef, final AbstractAnyRestClient restClient,
- final String realm, final String type) {
-
- super(id);
+ protected <T extends AnyTO> AbstractSearchResultPanel(
+ final String id,
+ final boolean filtered,
+ final String fiql,
+ final PageReference pageRef,
+ final AbstractAnyRestClient restClient,
+ final String realm,
+ final String type) {
- add(modal);
+ super(id, pageRef, true);
setOutputMarkupId(true);
@@ -133,7 +130,7 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i
this.restClient = restClient;
// Container for user search result
- container = new WebMarkupContainer("container");
+ container = new WebMarkupContainer("searchContainer");
container.setOutputMarkupId(true);
add(container);
@@ -177,7 +174,7 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i
paginatorForm.add(rowsChooser);
// ---------------------------
- setWindowClosedReloadCallback(modal);
+// setWindowClosedReloadCallback(modal);
}
public void search(final String fiql, final AjaxRequestTarget target) {
@@ -234,6 +231,7 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i
data.getTarget().add(container);
}
+ super.onEvent(event);
}
private void setWindowClosedReloadCallback(final BaseModal<?> modal) {
@@ -299,4 +297,50 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i
protected abstract <T extends AnyTO> Collection<ActionLink.ActionType> getBulkActions();
protected abstract String getPageId();
+
+ public abstract static class Builder<T extends Serializable> extends WizardMgtPanel.Builder<T> {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Specify if results are about a filtered search or not. Using this attribute it is possible to use this panel
+ * to
+ * show results about user list and user search.
+ */
+ protected final boolean filtered;
+
+ /**
+ * Filter used in case of filtered search.
+ */
+ protected final String fiql;
+
+ protected final AbstractAnyRestClient restClient;
+
+ /**
+ * Realm related to current panel.
+ */
+ protected final String realm;
+
+ /**
+ * Any type related to current panel.
+ */
+ protected final String type;
+
+ protected Builder(
+ final Class<T> reference,
+ final boolean filtered,
+ final String fiql,
+ final PageReference pageRef,
+ final AbstractAnyRestClient restClient,
+ final String realm,
+ final String type) {
+ super(reference, pageRef);
+ this.filtered = filtered;
+ this.fiql = fiql;
+ this.restClient = restClient;
+ this.realm = realm;
+ this.type = type;
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
index 5041c6e..0272555 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java
@@ -61,7 +61,7 @@ public class AjaxDataTablePanel<T, S> extends DataTablePanel<T, S> {
super(id);
- final BaseModal<?> bulkModalWin = new BaseModal("bulkModal");
+ final BaseModal<?> bulkModalWin = new BaseModal<>("bulkModal");
add(bulkModalWin);
bulkModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java
index eacdb4f..4e3efe3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.panels;
import java.io.Serializable;
import java.lang.reflect.Field;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -29,12 +28,13 @@ import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.AnyDisplayAttributesModalPage;
import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.rest.AbstractAnyRestClient;
-import org.apache.syncope.client.console.rest.AnyObjectRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
@@ -42,12 +42,11 @@ import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;
import org.springframework.util.ReflectionUtils;
@@ -65,9 +64,15 @@ public class AnySearchResultPanel<T extends AnyTO> extends AbstractSearchResultP
private final String entitlement = "USER_LIST";
- public AnySearchResultPanel(final String type, final String parentId, final boolean filtered,
- final String fiql, final PageReference callerRef, final AbstractAnyRestClient restClient,
- final List<AnyTypeClassTO> anyTypeClassTOs, final String realm) {
+ protected AnySearchResultPanel(
+ final String type,
+ final String parentId,
+ final boolean filtered,
+ final String fiql,
+ final PageReference callerRef,
+ final AbstractAnyRestClient restClient,
+ final List<AnyTypeClassTO> anyTypeClassTOs,
+ final String realm) {
super(parentId, filtered, fiql, callerRef, restClient, realm, type);
//setCustomMarkupId(markupId);
@@ -139,16 +144,8 @@ public class AnySearchResultPanel<T extends AnyTO> extends AbstractSearchResultP
@Override
public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) {
- final T modelObject = ((AnyObjectRestClient) restClient).<T>read(anyTO.getKey());
-
- final IModel<T> model = new CompoundPropertyModel<>(modelObject);
- modal.setFormModel(model);
-
- // still missing content
- target.add(modal);
-
- modal.header(new Model<String>(MessageFormat.format(getString("any.edit"), anyTO.getKey())));
- modal.show(true);
+ send(AnySearchResultPanel.this, Broadcast.BREADTH,
+ new AjaxWizard.NewItemActionEvent<AnyTO>(model.getObject(), target));
}
}, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink<AnyTO>() {
@@ -222,4 +219,30 @@ public class AnySearchResultPanel<T extends AnyTO> extends AbstractSearchResultP
protected String getPageId() {
return pageID;
}
+
+ public static final class Builder extends AbstractSearchResultPanel.Builder<AnyObjectTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final List<AnyTypeClassTO> anyTypeClassTOs;
+
+ public Builder(
+ final boolean filtered,
+ final String fiql,
+ final PageReference pageRef,
+ final AbstractAnyRestClient restClient,
+ final List<AnyTypeClassTO> anyTypeClassTOs,
+ final String realm,
+ final String type) {
+ super(AnyObjectTO.class, filtered, fiql, pageRef, restClient, realm, type);
+ this.anyTypeClassTOs = anyTypeClassTOs;
+ }
+
+ @Override
+ protected WizardMgtPanel<AnyObjectTO> newInstance(final String parentId) {
+ return new AnySearchResultPanel<AnyObjectTO>(
+ type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm);
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java
index 2e813ed..3447a97 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java
@@ -43,10 +43,10 @@ public abstract class ConnectorConfPanel extends AbstractConnectorConfPanel<Conn
this.bundles = bundles;
final List<ConnConfProperty> properties = getConnProperties(model.getObject());
- model.getObject().getConfiguration().clear();
- model.getObject().getConfiguration().addAll(properties);
+ model.getObject().getConf().clear();
+ model.getObject().getConf().addAll(properties);
- setConfPropertyListView("configuration", true);
+ setConfPropertyListView("conf", true);
}
/**
@@ -67,10 +67,10 @@ public abstract class ConnectorConfPanel extends AbstractConnectorConfPanel<Conn
final ConnConfProperty property = new ConnConfProperty();
property.setSchema(key);
- if (instance.getKey() != 0 && instance.getConfigurationMap().containsKey(key.getName())
- && instance.getConfigurationMap().get(key.getName()).getValues() != null) {
- property.getValues().addAll(instance.getConfigurationMap().get(key.getName()).getValues());
- property.setOverridable(instance.getConfigurationMap().get(key.getName()).isOverridable());
+ if (instance.getKey() != 0 && instance.getConfMap().containsKey(key.getName())
+ && instance.getConfMap().get(key.getName()).getValues() != null) {
+ property.getValues().addAll(instance.getConfMap().get(key.getName()).getValues());
+ property.setOverridable(instance.getConfMap().get(key.getName()).isOverridable());
}
if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java
deleted file mode 100644
index 9778881..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import org.apache.commons.lang3.SerializationUtils;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.client.console.rest.GroupRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.ResourceModel;
-
-/**
- * Modal window with Group form.
- */
-public class GroupModalPanel extends AbstractModalPanel {
-
- private static final long serialVersionUID = -1732493223434085205L;
-
- private final GroupRestClient groupRestClient = new GroupRestClient();
-
- protected final Mode mode;
-
- protected final boolean createFlag;
-
- protected final GroupPanel groupPanel;
-
- protected GroupTO originalGroupTO;
-
- public GroupModalPanel(
- final BaseModal<?> modal, final PageReference pageRef, final GroupTO groupTO) {
-
- this(modal, pageRef, groupTO, Mode.ADMIN);
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public GroupModalPanel(
- final BaseModal<?> modal, final PageReference pageRef, final GroupTO groupTO, final Mode mode) {
-
- super(modal, pageRef);
-
- this.mode = mode;
-
- this.createFlag = groupTO.getKey() == 0;
- if (!createFlag) {
- originalGroupTO = SerializationUtils.clone(groupTO);
- }
-
- final Form<GroupTO> form = new Form<>("groupForm");
- form.setMultiPart(true);
-
- add(new Label("displayName", groupTO.getKey() == 0 ? "" : groupTO.getDisplayName()));
-
- form.setModel(new CompoundPropertyModel<>(groupTO));
-
- this.groupPanel = new GroupPanel.Builder("groupPanel").
- form(form).groupTO(groupTO).groupModalPageMode(mode).build();
- form.add(groupPanel);
-
- final AjaxButton submit = new IndicatingAjaxButton(SUBMIT, new ResourceModel(SUBMIT)) {
-
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- try {
- submitAction(target, form);
- } catch (Exception e) {
- LOG.error("Failure managing groupTO {}", groupTO, e);
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- modal.getFeedbackPanel().refresh(target);
- }
- }
-
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- modal.getFeedbackPanel().refresh(target);
- }
- };
- form.add(submit);
- form.setDefaultButton(submit);
- }
-
- protected void submitAction(final AjaxRequestTarget target, final Form<?> form) {
- final GroupTO groupTO = (GroupTO) form.getDefaultModelObject();
-
- GroupTO result;
- if (createFlag) {
- result = groupRestClient.create(groupTO);
- } else {
- result = groupRestClient.update(originalGroupTO.getETagValue(), groupTO);
- }
-
- //setResponsePage(new ResultStatusModal.Builder(window, result).build());
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java
deleted file mode 100644
index 3e58e61..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.io.Serializable;
-import org.apache.syncope.client.console.commons.Mode;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Panel;
-
-public final class GroupPanel extends Panel {
-
- private static final long serialVersionUID = 4216376097320768369L;
-
- public static class Builder implements Serializable {
-
- private static final long serialVersionUID = 8150440254654306070L;
-
- private String id;
-
- private Form form;
-
- private GroupTO groupTO;
-
- private Mode mode;
-
- private PageReference pageReference;
-
- public Builder(final String id) {
- this.id = id;
- }
-
- public Builder form(final Form form) {
- this.form = form;
- return this;
- }
-
- public Builder groupTO(final GroupTO groupTO) {
- this.groupTO = groupTO;
- return this;
- }
-
- public Builder groupModalPageMode(final Mode mode) {
- this.mode = mode;
- return this;
- }
-
- public GroupPanel build() {
- return new GroupPanel(this);
- }
- }
-
- private GroupPanel(final Builder builder) {
- super(builder.id);
-
-
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
index 458298b..3e94680 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java
@@ -34,6 +34,8 @@ import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
@@ -41,21 +43,28 @@ import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
import org.springframework.util.ReflectionUtils;
-public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> {
+public final class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> {
private static final long serialVersionUID = -1100228004207271270L;
private final String entitlement = "GROUP_READ";
- public GroupSearchResultPanel(final String type, final String parentId,
- final boolean filtered, final String fiql, final PageReference callerRef,
- final AbstractAnyRestClient restClient, final List<AnyTypeClassTO> anyTypeClassTOs, final String realm) {
+ private GroupSearchResultPanel(
+ final String type,
+ final String parentId,
+ final boolean filtered,
+ final String fiql,
+ final PageReference callerRef,
+ final AbstractAnyRestClient restClient,
+ final List<AnyTypeClassTO> anyTypeClassTOs,
+ final String realm) {
super(type, parentId, filtered, fiql, callerRef, restClient, anyTypeClassTOs, realm);
}
@@ -73,8 +82,7 @@ public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> {
} else if (field != null && field.getType().equals(Date.class)) {
columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
} else {
- columns.add(
- new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
+ columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
}
}
@@ -115,11 +123,8 @@ public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> {
@Override
public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) {
- modal.addOrReplace(new GroupModalPanel(
- modal, getPage().getPageReference(), GroupTO.class.cast(model.getObject())));
-
- target.add(modal);
- modal.show(target);
+ send(GroupSearchResultPanel.this, Broadcast.BREADTH,
+ new AjaxWizard.NewItemActionEvent<AnyTO>(model.getObject(), target));
}
}, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink<AnyTO>() {
@@ -219,4 +224,30 @@ public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> {
protected String getPageId() {
return pageID;
}
+
+ public static final class Builder extends AbstractSearchResultPanel.Builder<GroupTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final List<AnyTypeClassTO> anyTypeClassTOs;
+
+ public Builder(
+ final boolean filtered,
+ final String fiql,
+ final PageReference pageRef,
+ final AbstractAnyRestClient restClient,
+ final List<AnyTypeClassTO> anyTypeClassTOs,
+ final String realm,
+ final String type) {
+ super(GroupTO.class, filtered, fiql, pageRef, restClient, realm, type);
+ this.anyTypeClassTOs = anyTypeClassTOs;
+ }
+
+ @Override
+ protected WizardMgtPanel<GroupTO> newInstance(final String parentId) {
+ return new GroupSearchResultPanel(
+ type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm);
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
index ca67bdb..229bcca 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
@@ -27,28 +27,21 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
import org.apache.syncope.client.console.wizards.AjaxWizard;
-import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.Broadcast;
import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.ResourceModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public final class ListViewPanel<T extends Serializable> extends Panel {
+public final class ListViewPanel<T extends Serializable> extends WizardMgtPanel<T> {
private static final long serialVersionUID = -7982691107029848579L;
@@ -57,18 +50,8 @@ public final class ListViewPanel<T extends Serializable> extends Panel {
*/
private static final Logger LOG = LoggerFactory.getLogger(ListViewPanel.class);
- private final ClearIndicatingAjaxButton addButton;
-
- private AjaxWizardBuilder<T> newItemPanelBuilder;
-
- private final WebMarkupContainer container;
-
- private final Fragment initialFragment;
-
private final List<T> listOfItems;
- private NotificationPanel notificationPanel;
-
/**
* Table view of a list of beans.
*
@@ -85,16 +68,10 @@ public final class ListViewPanel<T extends Serializable> extends Panel {
final List<String> includes,
final ActionLinksPanel.Builder<T> actions,
final PageReference pageRef) {
- super(id);
+ super(id, pageRef);
setOutputMarkupId(true);
- container = new WebMarkupContainer("container");
- add(container.setOutputMarkupId(true));
-
- initialFragment = new Fragment("content", "table", this);
- container.addOrReplace(initialFragment);
-
- initialFragment.add(new Label("caption", new ResourceModel("listview.caption", StringUtils.EMPTY)));
+ add(new Label("caption", new ResourceModel("listview.caption", StringUtils.EMPTY)));
final List<String> toBeIncluded;
if (includes == null || includes.isEmpty()) {
@@ -130,7 +107,7 @@ public final class ListViewPanel<T extends Serializable> extends Panel {
item.add(new Label("name", new ResourceModel(item.getModelObject(), item.getModelObject())));
}
};
- initialFragment.add(names);
+ add(names);
final ListView<T> beans = new ListView<T>("beans", listOfItems) {
@@ -169,78 +146,14 @@ public final class ListViewPanel<T extends Serializable> extends Panel {
beanItem.add(actions.build("actions", bean));
}
};
+ beans.setOutputMarkupId(true);
beans.setReuseItems(true);
- initialFragment.add(beans);
-
- addButton = new ClearIndicatingAjaxButton("add", pageRef) {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
- send(ListViewPanel.this, Broadcast.DEPTH, new AjaxWizard.NewItemActionEvent<T>(null, target));
- }
- };
-
- addButton.setEnabled(false);
- addButton.setVisible(false);
-
- initialFragment.add(addButton);
+ add(beans);
}
- @Override
- @SuppressWarnings("unchecked")
- public void onEvent(final IEvent<?> event) {
- if (event.getPayload() instanceof AjaxWizard.NewItemEvent) {
- final AjaxRequestTarget target = AjaxWizard.NewItemEvent.class.cast(event.getPayload()).getTarget();
-
- final T item = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getItem();
-
- if (event.getPayload() instanceof AjaxWizard.NewItemActionEvent) {
- final Fragment fragment = new Fragment("content", "wizard", ListViewPanel.this);
- newItemPanelBuilder.setItem(item);
-
- fragment.add(newItemPanelBuilder.build(
- ((AjaxWizard.NewItemActionEvent<T>) event.getPayload()).getIndex()));
-
- container.addOrReplace(fragment);
- } else {
- if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) {
- if (item != null && !this.listOfItems.contains(item)) {
- this.listOfItems.add(item);
- }
-
- if (notificationPanel != null) {
- getSession().info(getString(Constants.OPERATION_SUCCEEDED));
- notificationPanel.refresh(target);
- }
- }
- container.addOrReplace(initialFragment);
- }
-
- target.add(container);
- }
- super.onEvent(event);
- }
-
- private ListViewPanel<T> addNewItemPanelBuilder(final AjaxWizardBuilder<T> panelBuilder) {
- this.newItemPanelBuilder = panelBuilder;
-
- if (this.newItemPanelBuilder != null) {
- addButton.setEnabled(true);
- addButton.setVisible(true);
- }
-
- return this;
- }
-
- private ListViewPanel<T> addNotificationPanel(final NotificationPanel notificationPanel) {
- this.notificationPanel = notificationPanel;
- return this;
- }
-
- public static <T extends Serializable> Builder<T> builder(final Class<T> reference, final PageReference pageRef) {
- return new Builder<T>(reference, pageRef);
+ public static <T extends Serializable> ListViewPanel.Builder<T> builder(
+ final Class<T> reference, final PageReference pageRef) {
+ return new ListViewPanel.Builder<T>(reference, pageRef);
}
/**
@@ -248,43 +161,23 @@ public final class ListViewPanel<T extends Serializable> extends Panel {
*
* @param <T> list item reference type.
*/
- public static final class Builder<T extends Serializable> implements Serializable {
+ public static final class Builder<T extends Serializable> extends WizardMgtPanel.Builder<T> {
private static final long serialVersionUID = 1L;
- private final PageReference pageRef;
-
- private final Class<T> reference;
-
private final List<String> includes = new ArrayList<>();
private final ActionLinksPanel.Builder<T> actions;
private List<T> items;
- private AjaxWizardBuilder<T> newItemPanelBuilder;
-
- private NotificationPanel notificationPanel;
-
private Builder(final Class<T> reference, final PageReference pageRef) {
- this.pageRef = pageRef;
- this.reference = reference;
+ super(reference, pageRef);
this.items = null;
this.actions = ActionLinksPanel.<T>builder(pageRef);
}
/**
- * Builds a list view.
- *
- * @param id component id.
- * @return List view.
- */
- public ListViewPanel<T> build(final String id) {
- return new ListViewPanel<T>(id, items, reference, includes, actions, pageRef).
- addNewItemPanelBuilder(newItemPanelBuilder).addNotificationPanel(notificationPanel);
- }
-
- /**
* Sets list of items.
*
* @param items list of items.
@@ -343,14 +236,28 @@ public final class ListViewPanel<T extends Serializable> extends Panel {
return this;
}
- public Builder<T> addNewItemPanelBuilder(final AjaxWizardBuilder<T> panelBuilder) {
- this.newItemPanelBuilder = panelBuilder;
- return this;
+ @Override
+ protected WizardMgtPanel<T> newInstance(final String id) {
+ return new ListViewPanel<T>(id, items, reference, includes, actions, pageRef);
}
+ }
- public Builder<T> addNotificationPanel(final NotificationPanel notificationPanel) {
- this.notificationPanel = notificationPanel;
- return this;
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onEvent(final IEvent<?> event) {
+ if (event.getPayload() instanceof AjaxWizard.NewItemEvent) {
+
+ final T item = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getItem();
+ final AjaxRequestTarget target = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getTarget();
+
+ if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) {
+ if (item != null && !this.listOfItems.contains(item)) {
+ this.listOfItems.add(item);
+ }
+ }
+
+ target.add(ListViewPanel.this);
}
+ super.onEvent(event);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java
new file mode 100644
index 0000000..681c1f2
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java
@@ -0,0 +1,30 @@
+/*
+ * 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.panels;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.request.component.IRequestableComponent;
+
+public interface ModalPanel extends IRequestableComponent {
+
+ void onSubmit(final AjaxRequestTarget target, final Form<?> form);
+
+ void onError(final AjaxRequestTarget target, final Form<?> form);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
index 3725019..edf35ee 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
@@ -22,12 +22,20 @@ import com.googlecode.wicket.jquery.core.panel.LabelPanel;
import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
import java.util.ArrayList;
import java.util.List;
+import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.rest.AnyObjectRestClient;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.client.console.rest.GroupRestClient;
import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.console.wizards.any.AnyWizardBuilder;
+import org.apache.syncope.client.console.wizards.any.GroupWizardBuilder;
+import org.apache.syncope.client.console.wizards.any.UserWizardBuilder;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.lib.to.UserTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
@@ -54,13 +62,16 @@ public class Realm extends Panel {
private final AnyObjectRestClient anyObjectRestClient = new AnyObjectRestClient();
+ private final PageReference pageRef;
+
@SuppressWarnings({ "unchecked", "unchecked" })
- public Realm(final String id, final RealmTO realmTO, final PageReference pageReference) {
+ public Realm(final String id, final RealmTO realmTO, final PageReference pageRef) {
super(id);
this.realmTO = realmTO;
this.anyTypeTOs = anyTypeRestClient.getAll();
+ this.pageRef = pageRef;
- add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageReference)));
+ add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageRef)));
}
public RealmTO getRealmTO() {
@@ -103,19 +114,44 @@ public class Realm extends Panel {
switch (anyTypeTO.getKind()) {
case USER:
- panel = new UserSearchResultPanel(anyTypeTO.getKey(), id,
- false, null, pageReference, userRestClient, anyTypeRestClient.getAnyTypeClass(
- anyTypeTO.getClasses()), realmTO.getFullPath());
+ final UserTO userTO = new UserTO();
+ userTO.setRealm(realmTO.getFullPath());
+ panel = new UserSearchResultPanel.Builder(
+ false, null, pageReference, userRestClient,
+ anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})),
+ realmTO.getFullPath(),
+ anyTypeTO.getKey()).
+ addNewItemPanelBuilder(new UserWizardBuilder(
+ BaseModal.CONTENT_ID, userTO, anyTypeTO.getClasses(), pageRef)).
+ addNotificationPanel(BasePage.class.cast(this.pageRef.getPage()).getFeedbackPanel()).
+ build(id);
break;
case GROUP:
- panel = new GroupSearchResultPanel(anyTypeTO.getKey(), id,
- false, null, pageReference, groupRestClient, anyTypeRestClient.getAnyTypeClass(
- anyTypeTO.getClasses()), realmTO.getFullPath());
+ final GroupTO groupTO = new GroupTO();
+ groupTO.setRealm(realmTO.getFullPath());
+ panel = new GroupSearchResultPanel.Builder(
+ false, null, pageReference, groupRestClient,
+ anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})),
+ realmTO.getFullPath(),
+ anyTypeTO.getKey()).
+ addNewItemPanelBuilder(new GroupWizardBuilder(
+ BaseModal.CONTENT_ID, groupTO, anyTypeTO.getClasses(), pageRef)).
+ addNotificationPanel(BasePage.class.cast(this.pageRef.getPage()).getFeedbackPanel()).
+ build(id);
break;
case ANY_OBJECT:
- panel = new AnySearchResultPanel<>(anyTypeTO.getKey(), id,
- false, null, pageReference, anyObjectRestClient, anyTypeRestClient.getAnyTypeClass(
- anyTypeTO.getClasses()), realmTO.getFullPath());
+ final AnyObjectTO anyObjectTO = new AnyObjectTO();
+ anyObjectTO.setRealm(realmTO.getFullPath());
+ anyObjectTO.setType(anyTypeTO.getKey());
+ panel = new AnySearchResultPanel.Builder(
+ false, null, pageReference, anyObjectRestClient,
+ anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})),
+ realmTO.getFullPath(),
+ anyTypeTO.getKey()).
+ addNewItemPanelBuilder(new AnyWizardBuilder<AnyObjectTO>(
+ BaseModal.CONTENT_ID, anyObjectTO, anyTypeTO.getClasses(), pageRef)).
+ addNotificationPanel(BasePage.class.cast(this.pageRef.getPage()).getFeedbackPanel()).
+ build(id);
break;
default:
panel = new LabelPanel(id, null);
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
index 730b4cf..a838a47 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
@@ -31,7 +31,7 @@ public abstract class ResourceConnConfPanel extends AbstractConnectorConfPanel<R
private static final long serialVersionUID = -7982691107029848579L;
- private ConnectorRestClient restClient = new ConnectorRestClient();
+ private final ConnectorRestClient restClient = new ConnectorRestClient();
private final boolean createFlag;
@@ -40,14 +40,14 @@ public abstract class ResourceConnConfPanel extends AbstractConnectorConfPanel<R
this.createFlag = createFlag;
- final List<ConnConfProperty> connConfProperties = getConnProperties(model.getObject());
+ final List<ConnConfProperty> confOverride = getConnProperties(model.getObject());
model.getObject().getConfOverride().clear();
- model.getObject().getConfOverride().addAll(connConfProperties);
+ model.getObject().getConfOverride().addAll(confOverride);
- setConfPropertyListView("connConfProperties", false);
+ setConfPropertyListView("confOverride", false);
- check.setEnabled(!connConfProperties.isEmpty());
- check.setVisible(!connConfProperties.isEmpty());
+ check.setEnabled(!confOverride.isEmpty());
+ check.setVisible(!confOverride.isEmpty());
}
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
index fe33899..3e9881f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java
@@ -72,12 +72,6 @@ public class ResourceDetailsPanel extends Panel {
new PropertyModel<Boolean>(model, "enforceMandatoryCondition"),
false));
- container.add(new AjaxCheckBoxPanel(
- "propagationPrimary",
- new ResourceModel("propagationPrimary", "propagationPrimary").getObject(),
- new PropertyModel<Boolean>(model, "propagationPrimary"),
- false));
-
container.add(new SpinnerFieldPanel<>(
"propagationPriority",
"propagationPriority",
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java
index 06725cf..26f638c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java
@@ -31,12 +31,13 @@ import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.pages.StatusModalPage;
import org.apache.syncope.client.console.pages.UserDisplayAttributesModalPage;
import org.apache.syncope.client.console.rest.AbstractAnyRestClient;
-import org.apache.syncope.client.console.rest.UserRestClient;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
@@ -44,6 +45,7 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.CompoundPropertyModel;
@@ -52,15 +54,21 @@ import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;
import org.springframework.util.ReflectionUtils;
-public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> {
+public final class UserSearchResultPanel extends AnySearchResultPanel<UserTO> {
private static final long serialVersionUID = -1100228004207271270L;
private final String entitlement = "USER_LIST";
- public UserSearchResultPanel(final String type, final String parentId,
- final boolean filtered, final String fiql, final PageReference callerRef,
- final AbstractAnyRestClient restClient, final List<AnyTypeClassTO> anyTypeClassTOs, final String realm) {
+ private UserSearchResultPanel(
+ final String type,
+ final String parentId,
+ final boolean filtered,
+ final String fiql,
+ final PageReference callerRef,
+ final AbstractAnyRestClient restClient,
+ final List<AnyTypeClassTO> anyTypeClassTOs,
+ final String realm) {
super(type, parentId, filtered, fiql, callerRef, restClient, anyTypeClassTOs, realm);
}
@@ -78,8 +86,7 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> {
} else if (field != null && field.getType().equals(Date.class)) {
columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
} else {
- columns.add(
- new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
+ columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
}
}
@@ -98,8 +105,7 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> {
// Add defaults in case of no selection
if (columns.isEmpty()) {
for (String name : UserDisplayAttributesModalPage.USER_DEFAULT_SELECTION) {
- columns.add(
- new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
+ columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name));
}
prefMan.setList(getRequest(), getResponse(), Constants.PREF_USERS_DETAILS_VIEW,
@@ -155,15 +161,8 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> {
@Override
public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) {
- final UserTO modelObject = ((UserRestClient) restClient).read(model.getObject().getKey());
-
- final IModel<UserTO> model = new CompoundPropertyModel<>(modelObject);
- modal.setFormModel(model);
-
- target.add(modal);
-
- modal.header(new Model<String>(MessageFormat.format(getString("any.edit"), anyTO.getKey())));
- modal.show(true);
+ send(UserSearchResultPanel.this, Broadcast.BREADTH,
+ new AjaxWizard.NewItemActionEvent<AnyTO>(model.getObject(), target));
}
}, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink<AnyTO>() {
@@ -236,4 +235,29 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> {
protected String getPageId() {
return pageID;
}
+
+ public static final class Builder extends AbstractSearchResultPanel.Builder<UserTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final List<AnyTypeClassTO> anyTypeClassTOs;
+
+ public Builder(
+ final boolean filtered,
+ final String fiql,
+ final PageReference pageRef,
+ final AbstractAnyRestClient restClient,
+ final List<AnyTypeClassTO> anyTypeClassTOs,
+ final String realm,
+ final String type) {
+ super(UserTO.class, filtered, fiql, pageRef, restClient, realm, type);
+ this.anyTypeClassTOs = anyTypeClassTOs;
+ }
+
+ @Override
+ protected WizardMgtPanel<UserTO> newInstance(final String parentId) {
+ return new UserSearchResultPanel(
+ type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
index 113e30d..85b7c88 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java
@@ -20,9 +20,15 @@ package org.apache.syncope.client.console.rest;
import java.util.ArrayList;
import java.util.List;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.patch.AnyObjectPatch;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
+import org.apache.syncope.common.rest.api.service.AnyObjectService;
import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
import org.apache.syncope.common.rest.api.service.AnyTypeService;
import org.springframework.stereotype.Component;
@@ -35,6 +41,18 @@ public class AnyTypeRestClient extends BaseRestClient {
private static final long serialVersionUID = 1L;
+ public AnyTypeTO get(final String kind) {
+ AnyTypeTO type = null;
+
+ try {
+ type = getService(AnyTypeService.class).read(kind);
+ } catch (SyncopeClientException e) {
+ LOG.error("While reading all any types", e);
+ }
+
+ return type;
+ }
+
public List<AnyTypeTO> getAll() {
List<AnyTypeTO> types = null;
@@ -47,11 +65,28 @@ public class AnyTypeRestClient extends BaseRestClient {
return types;
}
- public List<AnyTypeClassTO> getAnyTypeClass(final List<String> anyTypeClassNames) {
+ public List<AnyTypeClassTO> getAnyTypeClass(final String... anyTypeClassNames) {
List<AnyTypeClassTO> anyTypeClassTOs = new ArrayList<>();
for (String anyTypeClass : anyTypeClassNames) {
anyTypeClassTOs.add(getService(AnyTypeClassService.class).read(anyTypeClass));
}
return anyTypeClassTOs;
}
+
+ public ProvisioningResult<AnyObjectTO> create(final AnyObjectTO anyObjectTO) {
+ Response response = getService(AnyObjectService.class).create(anyObjectTO);
+ return response.readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() {
+ });
+ }
+
+ public ProvisioningResult<AnyObjectTO> update(final String etag, final AnyObjectPatch anyObjectPatch) {
+ ProvisioningResult<AnyObjectTO> result;
+ synchronized (this) {
+ AnyObjectService service = getService(etag, AnyObjectService.class);
+ result = service.update(anyObjectPatch).readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() {
+ });
+ resetClient(AnyObjectService.class);
+ }
+ return result;
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
index c24cf53..d1ec74d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
@@ -25,7 +25,6 @@ import org.apache.syncope.client.console.commons.AttrLayoutType;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.rest.api.service.ConfigurationService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@@ -33,8 +32,7 @@ public class ConfigurationRestClient extends BaseRestClient {
private static final long serialVersionUID = 7692363064029538722L;
- @Autowired
- private SchemaRestClient schemaRestClient;
+ private SchemaRestClient schemaRestClient = new SchemaRestClient();
public List<AttrTO> list() {
final List<AttrTO> attrTOs = getService(ConfigurationService.class).list();
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
index a026119..fbf0ab0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java
@@ -19,13 +19,16 @@
package org.apache.syncope.client.console.rest;
import java.util.List;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.patch.GroupPatch;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.rest.api.service.AnyService;
import org.apache.syncope.common.rest.api.service.ResourceService;
@@ -85,20 +88,22 @@ public class GroupRestClient extends AbstractAnyRestClient {
return getService(ResourceService.class).readConnObject(resourceName, AnyTypeKind.GROUP.name(), id);
}
- public GroupTO create(final GroupTO groupTO) {
+ public ProvisioningResult<GroupTO> create(final GroupTO groupTO) {
Response response = getService(GroupService.class).create(groupTO);
- return response.readEntity(GroupTO.class);
+ return response.readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
+ });
}
public GroupTO read(final Long key) {
return getService(GroupService.class).read(key);
}
- public GroupTO update(final String etag, final GroupTO updated) {
- GroupTO result;
+ public ProvisioningResult<GroupTO> update(final String etag, final GroupPatch patch) {
+ ProvisioningResult<GroupTO> result;
synchronized (this) {
GroupService service = getService(etag, GroupService.class);
- result = service.update(updated).readEntity(GroupTO.class);
+ result = service.update(patch).readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
+ });
resetClient(GroupService.class);
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
index 6b9f244..ee95e5c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.rest;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import org.apache.commons.collections4.CollectionUtils;
@@ -60,26 +59,20 @@ public class SchemaRestClient extends BaseRestClient {
}
}
- public List<? extends AbstractSchemaTO> getSchemas(final SchemaType schemaType) {
- List<? extends AbstractSchemaTO> schemas = Collections.emptyList();
+ public <T extends AbstractSchemaTO> List<T> getSchemas(final SchemaType schemaType, final String... kind) {
+ List<T> schemas = new ArrayList<>();
try {
- schemas = getService(SchemaService.class).list(schemaType);
- } catch (SyncopeClientException e) {
- LOG.error("While getting all schemas for {}", schemaType, e);
- }
- return schemas;
- }
-
- public List<PlainSchemaTO> getSchemas() {
- List<PlainSchemaTO> schemas = null;
-
- try {
- schemas = getService(SchemaService.class).list(SchemaType.PLAIN);
+ if (kind == null || kind.length == 0) {
+ schemas.addAll(getService(SchemaService.class).<T>list(schemaType, null));
+ } else {
+ for (String clazz : kind) {
+ schemas.addAll(getService(SchemaService.class).<T>list(schemaType, clazz));
+ }
+ }
} catch (SyncopeClientException e) {
- LOG.error("While getting all schemas", e);
+ LOG.error("While getting all {} schemas for {}", schemaType, kind, e);
}
-
return schemas;
}
@@ -109,7 +102,7 @@ public class SchemaRestClient extends BaseRestClient {
List<DerSchemaTO> userDerSchemas = null;
try {
- userDerSchemas = getService(SchemaService.class).list(SchemaType.DERIVED);
+ userDerSchemas = getService(SchemaService.class).list(SchemaType.DERIVED, null);
} catch (SyncopeClientException e) {
LOG.error("While getting all user derived schemas", e);
}
@@ -125,7 +118,7 @@ public class SchemaRestClient extends BaseRestClient {
List<VirSchemaTO> userVirSchemas = null;
try {
- userVirSchemas = getService(SchemaService.class).list(SchemaType.VIRTUAL);
+ userVirSchemas = getService(SchemaService.class).list(SchemaType.VIRTUAL, null);
} catch (SyncopeClientException e) {
LOG.error("While getting all virtual schemas", e);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
index cf92dad..2f148c4 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.console.rest;
import java.util.List;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.syncope.client.console.commons.status.StatusBean;
import org.apache.syncope.client.console.commons.status.StatusUtils;
@@ -29,6 +30,7 @@ import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.StatusPatchType;
@@ -67,16 +69,18 @@ public class UserRestClient extends AbstractAnyRestClient {
getResult();
}
- public UserTO create(final UserTO userTO, final boolean storePassword) {
+ public ProvisioningResult<UserTO> create(final UserTO userTO, final boolean storePassword) {
Response response = getService(UserService.class).create(userTO, storePassword);
- return response.readEntity(UserTO.class);
+ return response.readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ });
}
- public UserTO update(final String etag, final UserPatch userPatch) {
- UserTO result;
+ public ProvisioningResult<UserTO> update(final String etag, final UserPatch userPatch) {
+ ProvisioningResult<UserTO> result;
synchronized (this) {
UserService service = getService(etag, UserService.class);
- result = service.update(userPatch).readEntity(UserTO.class);
+ result = service.update(userPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ });
resetClient(UserService.class);
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java
index e052846..70491e2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java
@@ -36,11 +36,13 @@ public abstract class ClearIndicatingAjaxLink<T> extends IndicatingAjaxLink<T> {
public ClearIndicatingAjaxLink(final String id, final PageReference pageRef) {
super(id);
this.pageRef = pageRef;
+ setOutputMarkupId(true);
}
public ClearIndicatingAjaxLink(final String id, final IModel<T> model, final PageReference pageRef) {
super(id, model);
this.pageRef = pageRef;
+ setOutputMarkupId(true);
}
public ClearIndicatingAjaxLink<T> feedbackPanelAutomaticReload(final boolean reloadFeedbackPanel) {
[07/50] [abbrv] syncope git commit: [SYNCOPE-714] Add specific test +
introducing PropagationTaskExecStatus.NOT_ATTEMPTED
Posted by fm...@apache.org.
[SYNCOPE-714] Add specific test + introducing PropagationTaskExecStatus.NOT_ATTEMPTED
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/509d30ed
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/509d30ed
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/509d30ed
Branch: refs/heads/SYNCOPE-156
Commit: 509d30edad9365fe0d97d6c3d5d2288c92d5c69b
Parents: 1347c10
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 26 11:56:36 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 26 11:56:36 2015 +0100
----------------------------------------------------------------------
.../lib/types/PropagationTaskExecStatus.java | 3 +-
.../provisioning/java/ConnectorFacadeProxy.java | 4 +-
.../AbstractPropagationTaskExecutor.java | 19 ++-
.../fit/core/reference/AbstractITCase.java | 4 +-
.../syncope/fit/core/reference/GroupITCase.java | 126 ++++++++++++++++---
.../fit/core/reference/ResourceITCase.java | 8 +-
.../syncope/fit/core/reference/UserITCase.java | 3 +-
7 files changed, 128 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
index c676c3b..6ae4a36 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
@@ -28,6 +28,7 @@ public enum PropagationTaskExecStatus {
CREATED,
SUCCESS,
- FAILURE;
+ FAILURE,
+ NOT_ATTEMPTED;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/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 a3b865f..8640c50 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
@@ -226,8 +226,8 @@ public class ConnectorFacadeProxy implements Connector {
}
} else {
LOG.info("Update for {} was attempted, although the "
- + "connector only has these capabilities: {}. No action.", uid.getUidValue(), connInstance.
- getCapabilities());
+ + "connector only has these capabilities: {}. No action.",
+ uid.getUidValue(), connInstance.getCapabilities());
}
return result;
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
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 c083187..e87cd00 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
@@ -387,7 +387,9 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
default:
}
- execution.setStatus(PropagationTaskExecStatus.SUCCESS.name());
+ execution.setStatus(propagationAttempted[0]
+ ? PropagationTaskExecStatus.SUCCESS.name()
+ : PropagationTaskExecStatus.NOT_ATTEMPTED.name());
for (PropagationActions action : actions) {
action.after(task, execution, afterObj);
@@ -437,24 +439,19 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
}
}
- LOG.debug("Update execution for {}", task);
-
execution.setStartDate(startDate);
execution.setMessage(taskExecutionMessage);
execution.setEndDate(new Date());
+ LOG.debug("Execution finished: {}", execution);
+
if (hasToBeregistered(task, execution)) {
- if (!propagationAttempted[0]) {
- LOG.debug("No propagation attempted for {}", execution);
- } else {
- execution.setTask(task);
- task.addExec(execution);
+ LOG.debug("Execution to be stored: {}", execution);
- LOG.debug("Execution finished: {}", execution);
- }
+ execution.setTask(task);
+ task.addExec(execution);
taskDAO.save(task);
-
// this flush call is needed to generate a value for the execution id
taskDAO.flush();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index 60565e1..3e4381d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -341,7 +341,7 @@ public abstract class AbstractITCase {
throw (RuntimeException) ex;
}
}
- return getObject(response.getLocation(), AnyObjectService.class, AnyObjectTO.class);
+ return response.readEntity(AnyObjectTO.class);
}
protected AnyObjectTO updateAnyObject(final AnyObjectPatch anyObjectPatch) {
@@ -360,7 +360,7 @@ public abstract class AbstractITCase {
throw (RuntimeException) ex;
}
}
- return getObject(response.getLocation(), GroupService.class, GroupTO.class);
+ return response.readEntity(GroupTO.class);
}
protected GroupTO updateGroup(final GroupPatch groupPatch) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
index 148f0eb..db12a2b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@ -52,6 +52,7 @@ import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.PagedResult;
@@ -63,9 +64,11 @@ import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.common.lib.types.IntMappingType;
import org.apache.syncope.common.lib.types.MappingPurpose;
import org.apache.syncope.common.lib.types.PatchOperation;
+import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.common.lib.types.ResourceAssociationAction;
import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
import org.apache.syncope.common.lib.types.SchemaType;
@@ -610,6 +613,111 @@ public class GroupITCase extends AbstractITCase {
}
@Test
+ public void dynMembership() {
+ assertTrue(userService.read(4L).getDynGroups().isEmpty());
+
+ GroupTO group = getBasicSampleTO("dynMembership");
+ group.setUDynMembershipCond("cool==true");
+ group = createGroup(group);
+ assertNotNull(group);
+
+ assertTrue(userService.read(4L).getDynGroups().contains(group.getKey()));
+
+ GroupPatch mod = new GroupPatch();
+ mod.setKey(group.getKey());
+ mod.setUDynMembershipCond(new StringReplacePatchItem.Builder().value("cool==false").build());
+ groupService.update(mod);
+
+ assertTrue(userService.read(4L).getDynGroups().isEmpty());
+ }
+
+ @Test
+ public void capabilitiesOverride() {
+ // resource with no capability override
+ ResourceTO ldap = resourceService.read(RESOURCE_NAME_LDAP);
+ assertNotNull(ldap);
+ assertFalse(ldap.isOverrideCapabilities());
+ assertTrue(ldap.getCapabilitiesOverride().isEmpty());
+
+ // connector with all required for create and update
+ ConnInstanceTO conn = connectorService.read(ldap.getConnector(), null);
+ assertNotNull(conn);
+ assertTrue(conn.getCapabilities().contains(ConnectorCapability.CREATE));
+ assertTrue(conn.getCapabilities().contains(ConnectorCapability.UPDATE));
+
+ try {
+ // 1. create succeeds
+ GroupTO group = getSampleTO("syncope714");
+ group.getPlainAttrs().add(attrTO("title", "first"));
+ group.getResources().add(RESOURCE_NAME_LDAP);
+
+ group = createGroup(group);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+
+ // 2. update succeeds
+ GroupPatch patch = new GroupPatch();
+ patch.setKey(group.getKey());
+ patch.getPlainAttrs().add(new AttrPatch.Builder().
+ operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "second")).build());
+
+ group = groupService.update(patch).readEntity(GroupTO.class);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+
+ // 3. set capability override with only search allowed, but not enable
+ ldap.getCapabilitiesOverride().add(ConnectorCapability.SEARCH);
+ resourceService.update(ldap);
+ ldap = resourceService.read(RESOURCE_NAME_LDAP);
+ assertNotNull(ldap);
+ assertFalse(ldap.isOverrideCapabilities());
+ assertEquals(1, ldap.getCapabilitiesOverride().size());
+ assertTrue(ldap.getCapabilitiesOverride().contains(ConnectorCapability.SEARCH));
+
+ // 4. update succeeds again
+ patch = new GroupPatch();
+ patch.setKey(group.getKey());
+ patch.getPlainAttrs().add(new AttrPatch.Builder().
+ operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "third")).build());
+
+ group = groupService.update(patch).readEntity(GroupTO.class);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+
+ // 5. enable capability override
+ ldap.setOverrideCapabilities(true);
+ resourceService.update(ldap);
+ ldap = resourceService.read(RESOURCE_NAME_LDAP);
+ assertNotNull(ldap);
+ assertTrue(ldap.isOverrideCapabilities());
+ assertEquals(1, ldap.getCapabilitiesOverride().size());
+ assertTrue(ldap.getCapabilitiesOverride().contains(ConnectorCapability.SEARCH));
+
+ // 6. update now fails
+ patch = new GroupPatch();
+ patch.setKey(group.getKey());
+ patch.getPlainAttrs().add(new AttrPatch.Builder().
+ operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "fourth")).build());
+
+ group = groupService.update(patch).readEntity(GroupTO.class);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, group.getPropagationStatusTOs().get(0).getStatus());
+ } finally {
+ ldap.getCapabilitiesOverride().clear();
+ ldap.setOverrideCapabilities(false);
+ resourceService.update(ldap);
+ }
+ }
+
+ @Test
public void issueSYNCOPE632() {
GroupTO groupTO = null;
try {
@@ -695,22 +803,4 @@ public class GroupITCase extends AbstractITCase {
}
}
- @Test
- public void dynMembership() {
- assertTrue(userService.read(4L).getDynGroups().isEmpty());
-
- GroupTO group = getBasicSampleTO("dynMembership");
- group.setUDynMembershipCond("cool==true");
- group = createGroup(group);
- assertNotNull(group);
-
- assertTrue(userService.read(4L).getDynGroups().contains(group.getKey()));
-
- GroupPatch mod = new GroupPatch();
- mod.setKey(group.getKey());
- mod.setUDynMembershipCond(new StringReplacePatchItem.Builder().value("cool==false").build());
- groupService.update(mod);
-
- assertTrue(userService.read(4L).getDynGroups().isEmpty());
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
index 5d4d176..9aa64ce 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
@@ -161,15 +161,15 @@ public class ResourceITCase extends AbstractITCase {
resourceTO.setKey(resourceName);
resourceTO.setConnector(102L);
- ConnConfProperty p = new ConnConfProperty();
+ ConnConfProperty prop = new ConnConfProperty();
ConnConfPropSchema schema = new ConnConfPropSchema();
schema.setType("java.lang.String");
schema.setName("endpoint");
schema.setRequired(true);
- p.setSchema(schema);
- p.getValues().add("http://invalidurl/");
+ prop.setSchema(schema);
+ prop.getValues().add("http://invalidurl/");
- Set<ConnConfProperty> connectorConfigurationProperties = new HashSet<>(Arrays.asList(p));
+ Set<ConnConfProperty> connectorConfigurationProperties = new HashSet<>(Arrays.asList(prop));
resourceTO.getConfOverride().addAll(connectorConfigurationProperties);
Response response = resourceService.create(resourceTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/509d30ed/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
index ebaf02b..1811805 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
@@ -171,7 +171,8 @@ public class UserITCase extends AbstractITCase {
// get last task
PropagationTaskTO taskTO = taskService.read(newMaxId);
assertNotNull(taskTO);
- assertTrue(taskTO.getExecutions().isEmpty());
+ assertFalse(taskTO.getExecutions().isEmpty());
+ assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED.name(), taskTO.getExecutions().get(0).getStatus());
}
@Test
[03/50] [abbrv] syncope git commit: [SYNCOPE-714] Preliminary changes
+ small refactoring of ConnectorService
Posted by fm...@apache.org.
[SYNCOPE-714] Preliminary changes + small refactoring of ConnectorService
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/93439817
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/93439817
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/93439817
Branch: refs/heads/SYNCOPE-156
Commit: 934398172f91b1128a0d3bac12c4a0ac2e1dea55
Parents: 7f584fb
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 23 11:04:39 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 26 08:26:45 2015 +0100
----------------------------------------------------------------------
.../console/panels/ResourceConnConfPanel.java | 2 +-
.../console/rest/ConnectorRestClient.java | 23 +----------
.../rest/api/service/ConnectorService.java | 36 ++++++------------
.../syncope/core/logic/ConnectorLogic.java | 40 ++++++++++----------
.../java/data/ConnInstanceDataBinderImpl.java | 9 +++--
.../rest/cxf/service/ConnectorServiceImpl.java | 34 ++---------------
.../fit/core/reference/ConnectorITCase.java | 12 +++---
7 files changed, 50 insertions(+), 106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
index 1b536c4..246e0eb 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
@@ -116,7 +116,7 @@ public class ResourceConnConfPanel extends Panel {
List<ConnConfProperty> props = new ArrayList<>();
Long connectorKey = resourceTO.getConnector();
if (connectorKey != null && connectorKey > 0) {
- for (ConnConfProperty property : restClient.getConnectorProperties(connectorKey)) {
+ for (ConnConfProperty property : restClient.read(connectorKey).getConfiguration()) {
if (property.isOverridable()) {
props.add(property);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
index d3d18c8..8c84993 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
@@ -108,24 +108,6 @@ public class ConnectorRestClient extends BaseRestClient {
return bundles;
}
- /**
- * Get all configuration properties for the given connector instance.
- *
- * @param connectorId the connector id
- * @return List of ConnConfProperty, or an empty list in case none found
- */
- public List<ConnConfProperty> getConnectorProperties(final Long connectorId) {
- List<ConnConfProperty> properties = null;
-
- try {
- properties = getService(ConnectorService.class).getConfigurationProperties(connectorId);
- } catch (SyncopeClientException e) {
- LOG.error("While getting connector configuration properties", e);
- }
-
- return properties;
- }
-
private Set<ConnConfProperty> filterProperties(final Set<ConnConfProperty> properties) {
Set<ConnConfProperty> newProperties = new HashSet<>();
@@ -185,8 +167,7 @@ public class ConnectorRestClient extends BaseRestClient {
public List<String> getSchemaNames(final ConnInstanceTO connectorTO) {
List<String> schemaNames = new ArrayList<>();
try {
- List<PlainSchemaTO> response = getService(ConnectorService.class).
- getSchemaNames(connectorTO.getKey(), connectorTO, false);
+ List<PlainSchemaTO> response = getService(ConnectorService.class).buildSchemaNames(connectorTO, false);
for (PlainSchemaTO schema : response) {
schemaNames.add(schema.getKey());
}
@@ -203,7 +184,7 @@ public class ConnectorRestClient extends BaseRestClient {
public List<ConnIdObjectClass> getSupportedObjectClasses(final ConnInstanceTO connectorTO) {
List<ConnIdObjectClass> result = Collections.emptyList();
try {
- result = getService(ConnectorService.class).getSupportedObjectClasses(connectorTO.getKey(), connectorTO);
+ result = getService(ConnectorService.class).buildSupportedObjectClasses(connectorTO);
} catch (Exception e) {
LOG.error("While getting supported object classes", e);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
index 686d373..ea63718 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
@@ -37,7 +37,6 @@ import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.wrap.ConnIdObjectClass;
/**
@@ -58,47 +57,36 @@ public interface ConnectorService extends JAXRSService {
List<ConnBundleTO> getBundles(@QueryParam("lang") String lang);
/**
- * Returns configuration for given connector instance.
+ * Builds the list of schema names managed by the connector bundle matching the given connector instance key, with
+ * the provided configuration.
*
- * @param key connector instance key to read configuration from
- * @return configuration for given connector instance
- */
- @GET
- @Path("{key}/configuration")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<ConnConfProperty> getConfigurationProperties(@NotNull @PathParam("key") Long key);
-
- /**
- * Returns schema names for connector bundle matching the given connector instance key.
- *
- * @param key connector instance key to be used for schema lookup
- * @param connInstanceTO connector instance object to provide special configuration properties
+ * @param connInstanceTO connector instance object providing configuration properties
* @param includeSpecial if set to true, special schema names (like '__PASSWORD__') will be included;
* default is false
- * @return schema names for connector bundle matching the given connector instance key
+ * @return schema names for the connector bundle matching the given connector instance key, with the provided
+ * configuration
*/
@POST
@Path("{key}/schemaNames")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<PlainSchemaTO> getSchemaNames(@NotNull @PathParam("key") Long key,
+ List<PlainSchemaTO> buildSchemaNames(
@NotNull ConnInstanceTO connInstanceTO,
@QueryParam("includeSpecial") @DefaultValue("false") boolean includeSpecial);
/**
- * Returns supported object classes for connector bundle matching the given connector instance key.
+ * Builds the list of supported ConnId object classes for the connector bundle matching the given connector instance
+ * key, with the provided configuration.
*
- * @param key connector instance key to be used for schema lookup
- * @param connInstanceTO connector instance object to provide special configuration properties
- * @return supported object classes for connector bundle matching the given connector instance key
+ * @param connInstanceTO connector instance object providing configuration properties
+ * @return supported object classes for the connector bundle matching the given connector instance key, with the
+ * provided configuration
*/
@POST
@Path("{key}/supportedObjectClasses")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<ConnIdObjectClass> getSupportedObjectClasses(
- @NotNull @PathParam("key") Long key,
- @NotNull ConnInstanceTO connInstanceTO);
+ List<ConnIdObjectClass> buildSupportedObjectClasses(@NotNull ConnInstanceTO connInstanceTO);
/**
* Returns connector instance with matching key.
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
index 870a4d0..cc6aaed 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
@@ -33,6 +33,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.Entitlement;
@@ -204,7 +205,7 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
- public List<String> getSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
+ public List<PlainSchemaTO> buildSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
@@ -217,12 +218,22 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
// We cannot use Spring bean because this method could be used during resource definition or modification:
// bean couldn't exist or couldn't be updated.
// This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
- return new ArrayList<>(connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial));
+ Set<String> schemaNames = connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial);
+
+ return CollectionUtils.collect(schemaNames, new Transformer<String, PlainSchemaTO>() {
+
+ @Override
+ public PlainSchemaTO transform(final String name) {
+ PlainSchemaTO schemaTO = new PlainSchemaTO();
+ schemaTO.setKey(name);
+ return schemaTO;
+ }
+ }, new ArrayList<PlainSchemaTO>());
}
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
- public List<String> getSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
+ public List<String> buildSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
@@ -237,24 +248,13 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
// This is the reason why we should take a "not mature" connector facade proxy to ask for object classes.
Set<ObjectClass> objectClasses = connFactory.createConnector(connInstance, conf).getSupportedObjectClasses();
- List<String> result = new ArrayList<>(objectClasses.size());
- for (ObjectClass objectClass : objectClasses) {
- result.add(objectClass.getObjectClassValue());
- }
-
- return result;
- }
-
- @PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
- @Transactional(readOnly = true)
- public List<ConnConfProperty> getConfigurationProperties(final Long connInstanceKey) {
-
- ConnInstance connInstance = connInstanceDAO.find(connInstanceKey);
- if (connInstance == null) {
- throw new NotFoundException("Connector '" + connInstanceKey + "'");
- }
+ return CollectionUtils.collect(objectClasses, new Transformer<ObjectClass, String>() {
- return new ArrayList<>(connInstance.getConfiguration());
+ @Override
+ public String transform(final ObjectClass objectClass) {
+ return objectClass.getObjectClassValue();
+ }
+ }, new ArrayList<String>());
}
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
index 3666d8f..7c28b66 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConnInstanceDataBinderImpl.java
@@ -58,13 +58,14 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
private EntityFactory entityFactory;
@Override
- public Set<ConnConfProperty> mergeConnConfProperties(final Set<ConnConfProperty> primary,
+ public Set<ConnConfProperty> mergeConnConfProperties(
+ final Set<ConnConfProperty> primary,
final Set<ConnConfProperty> secondary) {
- final Set<ConnConfProperty> conf = new HashSet<>();
+ Set<ConnConfProperty> conf = new HashSet<>();
// to be used to control managed prop (needed by overridden mechanism)
- final Set<String> propertyNames = new HashSet<>();
+ Set<String> propertyNames = new HashSet<>();
// get overridden connector configuration properties
for (ConnConfProperty prop : primary) {
@@ -232,7 +233,7 @@ public class ConnInstanceDataBinderImpl implements ConnInstanceDataBinder {
property = new ConnConfProperty();
connInstanceTO.getConfiguration().add(property);
}
-
+
property.setSchema(schema);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
index a970827..ac0694d 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
@@ -19,17 +19,13 @@
package org.apache.syncope.core.rest.cxf.service;
import java.net.URI;
-import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.wrap.ConnIdObjectClass;
import org.apache.syncope.common.rest.api.CollectionWrapper;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -64,35 +60,13 @@ public class ConnectorServiceImpl extends AbstractServiceImpl implements Connect
}
@Override
- public List<ConnConfProperty> getConfigurationProperties(final Long key) {
- return logic.getConfigurationProperties(key);
+ public List<PlainSchemaTO> buildSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
+ return logic.buildSchemaNames(connInstanceTO, includeSpecial);
}
@Override
- public List<PlainSchemaTO> getSchemaNames(final Long key, final ConnInstanceTO connInstanceTO,
- final boolean includeSpecial) {
-
- connInstanceTO.setKey(key);
-
- return CollectionUtils.collect(logic.getSchemaNames(connInstanceTO, includeSpecial),
- new Transformer<String, PlainSchemaTO>() {
-
- @Override
- public PlainSchemaTO transform(final String name) {
- PlainSchemaTO schemaTO = new PlainSchemaTO();
- schemaTO.setKey(name);
- return schemaTO;
- }
- }, new ArrayList<PlainSchemaTO>());
- }
-
- @Override
- public List<ConnIdObjectClass> getSupportedObjectClasses(final Long key,
- final ConnInstanceTO connInstanceTO) {
-
- connInstanceTO.setKey(key);
-
- return CollectionWrapper.wrap(logic.getSupportedObjectClasses(connInstanceTO), ConnIdObjectClass.class);
+ public List<ConnIdObjectClass> buildSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
+ return CollectionWrapper.wrap(logic.buildSupportedObjectClasses(connInstanceTO), ConnIdObjectClass.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/93439817/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
index cc97936..71859a7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
@@ -397,7 +397,7 @@ public class ConnectorITCase extends AbstractITCase {
@Test
public void getConnectorConfiguration() {
- List<ConnConfProperty> props = connectorService.getConfigurationProperties(104L);
+ Set<ConnConfProperty> props = connectorService.read(104L, Locale.ENGLISH.getLanguage()).getConfiguration();
assertNotNull(props);
assertFalse(props.isEmpty());
}
@@ -541,13 +541,13 @@ public class ConnectorITCase extends AbstractITCase {
public void getSchemaNames() {
ConnInstanceTO conn = connectorService.read(101L, Locale.ENGLISH.getLanguage());
- List<PlainSchemaTO> schemaNames = connectorService.getSchemaNames(conn.getKey(), conn, true);
+ List<PlainSchemaTO> schemaNames = connectorService.buildSchemaNames(conn, true);
assertNotNull(schemaNames);
assertFalse(schemaNames.isEmpty());
assertNotNull(schemaNames.get(0).getKey());
assertNull(schemaNames.get(0).getEnumerationValues());
- schemaNames = connectorService.getSchemaNames(conn.getKey(), conn, false);
+ schemaNames = connectorService.buildSchemaNames(conn, false);
assertNotNull(schemaNames);
assertEquals(1, schemaNames.size());
@@ -557,7 +557,7 @@ public class ConnectorITCase extends AbstractITCase {
// to be used with overridden properties
conn.getConfiguration().clear();
- schemaNames = connectorService.getSchemaNames(conn.getKey(), conn, true);
+ schemaNames = connectorService.buildSchemaNames(conn, true);
assertNotNull(schemaNames);
assertFalse(schemaNames.isEmpty());
}
@@ -567,7 +567,7 @@ public class ConnectorITCase extends AbstractITCase {
ConnInstanceTO ldap = connectorService.read(105L, Locale.ENGLISH.getLanguage());
assertNotNull(ldap);
- List<ConnIdObjectClass> objectClasses = connectorService.getSupportedObjectClasses(ldap.getKey(), ldap);
+ List<ConnIdObjectClass> objectClasses = connectorService.buildSupportedObjectClasses(ldap);
assertNotNull(objectClasses);
assertEquals(2, objectClasses.size());
assertTrue(objectClasses.contains(
@@ -578,7 +578,7 @@ public class ConnectorITCase extends AbstractITCase {
ConnInstanceTO csv = connectorService.read(104L, Locale.ENGLISH.getLanguage());
assertNotNull(csv);
- objectClasses = connectorService.getSupportedObjectClasses(csv.getKey(), csv);
+ objectClasses = connectorService.buildSupportedObjectClasses(csv);
assertNotNull(objectClasses);
assertEquals(1, objectClasses.size());
assertTrue(objectClasses.contains(
[44/50] [abbrv] syncope git commit: Merge branch 'master' into
SYNCOPE-156
Posted by fm...@apache.org.
Merge branch 'master' into SYNCOPE-156
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4c30ca70
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4c30ca70
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4c30ca70
Branch: refs/heads/SYNCOPE-156
Commit: 4c30ca705382bfc26b09c1675941ac28f5f7ddfc
Parents: 77fc5d2 d43268c
Author: fmartelli <fa...@gmail.com>
Authored: Fri Oct 30 11:39:15 2015 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Oct 30 11:39:15 2015 +0100
----------------------------------------------------------------------
.../cli/commands/CommonsResultManager.java | 13 ++
.../commands/connector/ConnectorCommand.java | 5 +
.../commands/connector/ConnectorDetails.java | 76 ++++++++++
.../connector/ConnectorResultManager.java | 7 +-
.../cli/commands/domain/DomainCommand.java | 5 +
.../cli/commands/domain/DomainDetails.java | 50 +++++++
.../commands/domain/DomainResultManager.java | 5 +
.../cli/commands/logger/LoggerCommand.java | 5 +
.../cli/commands/logger/LoggerDetails.java | 93 +++++++++++++
.../commands/logger/LoggerResultManager.java | 5 +
.../commands/notification/NotificationList.java | 5 +-
.../commands/notification/NotificationRead.java | 2 +-
.../notification/NotificationResultManager.java | 23 ++++
.../cli/commands/policy/PolicyCommand.java | 5 +
.../cli/commands/policy/PolicyDetails.java | 60 ++++++++
.../client/cli/commands/policy/PolicyList.java | 1 -
.../commands/policy/PolicyResultManager.java | 5 +
.../client/cli/commands/realm/RealmCommand.java | 5 +
.../client/cli/commands/realm/RealmDetails.java | 49 +++++++
.../cli/commands/realm/RealmResultManager.java | 5 +
.../cli/commands/report/ReportCommand.java | 5 +
.../cli/commands/report/ReportDetails.java | 59 ++++++++
.../client/cli/commands/report/ReportList.java | 4 +-
.../client/cli/commands/report/ReportRead.java | 2 +-
.../commands/report/ReportResultManager.java | 9 +-
.../cli/commands/resource/ResourceCommand.java | 5 +
.../cli/commands/resource/ResourceDetails.java | 52 +++++++
.../resource/ResourceResultManager.java | 8 ++
.../client/cli/commands/role/RoleCommand.java | 5 +
.../client/cli/commands/role/RoleDetails.java | 59 ++++++++
.../cli/commands/role/RoleResultManager.java | 5 +
.../cli/commands/schema/SchemaCommand.java | 5 +
.../cli/commands/schema/SchemaDetails.java | 58 ++++++++
.../commands/schema/SchemaResultManager.java | 5 +
.../client/cli/commands/task/TaskCommand.java | 5 +
.../client/cli/commands/task/TaskDetails.java | 137 +++++++++++++++++++
.../client/cli/commands/task/TaskList.java | 3 +-
.../cli/commands/task/TaskResultManager.java | 35 +++--
.../commands/task/TaskSyncopeOperations.java | 5 +-
.../client/cli/commands/user/UserCommand.java | 8 +-
.../client/cli/commands/user/UserCount.java | 45 ------
.../client/cli/commands/user/UserDetails.java | 73 ++++++++++
.../cli/commands/user/UserResultManager.java | 5 +
.../commands/user/UserSyncopeOperations.java | 4 -
.../apache/syncope/client/cli/view/Table.java | 2 +
45 files changed, 941 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
[38/50] [abbrv] syncope git commit: SYNCOPE-701 first working
implementation
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/img/ajax-loader.gif
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/img/ajax-loader.gif b/client/enduser/src/main/resources/META-INF/resources/app/img/ajax-loader.gif
new file mode 100644
index 0000000..766cf24
Binary files /dev/null and b/client/enduser/src/main/resources/META-INF/resources/app/img/ajax-loader.gif differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/img/busy.gif
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/img/busy.gif b/client/enduser/src/main/resources/META-INF/resources/app/img/busy.gif
new file mode 100644
index 0000000..e77264f
Binary files /dev/null and b/client/enduser/src/main/resources/META-INF/resources/app/img/busy.gif differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/img/favicon.png
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/img/favicon.png b/client/enduser/src/main/resources/META-INF/resources/app/img/favicon.png
new file mode 100644
index 0000000..aa2f3e2
Binary files /dev/null and b/client/enduser/src/main/resources/META-INF/resources/app/img/favicon.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/img/logo-green.png
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/img/logo-green.png b/client/enduser/src/main/resources/META-INF/resources/app/img/logo-green.png
new file mode 100644
index 0000000..c57b86c
Binary files /dev/null and b/client/enduser/src/main/resources/META-INF/resources/app/img/logo-green.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/img/logo.png
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/img/logo.png b/client/enduser/src/main/resources/META-INF/resources/app/img/logo.png
new file mode 100644
index 0000000..f05105e
Binary files /dev/null and b/client/enduser/src/main/resources/META-INF/resources/app/img/logo.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/index.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/index.html b/client/enduser/src/main/resources/META-INF/resources/app/index.html
new file mode 100644
index 0000000..6cb7ae6
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/index.html
@@ -0,0 +1,116 @@
+<!--
+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.
+-->
+
+<!DOCTYPE html>
+<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!--> <html lang="en" ng-app="SyncopeEnduserApp" class="no-js"> <!--<![endif]-->
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>SyncopeEnduserApp</title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <!--<link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">-->
+ <!--<link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">-->
+ <link rel="stylesheet" href="css/app.css">
+ <!--<script src="bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js"></script>-->
+ </head>
+ <body ng-cloak >
+ <!--<button ng-click=""-->
+
+ <!--[if lt IE 7]>
+ <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
+ <![endif]-->
+
+ <!--<div ng-view ng-cloak ng-controller="ApplicationController"></div>-->
+ <div ui-view ng-cloak ng-controller="ApplicationController"></div>
+
+ <!-- <footer id="footer" class="hidden-print">
+ <ul class="nav pull-right">
+ <li>
+ Copyright © 2015, Apache Syncope
+ </li>
+ </ul>
+ </footer>-->
+
+ <!--default global growl message-->
+ <!--<div growl></div>-->
+
+ <!-- <div class="hidden-print" id="initialLoaderDiv">
+ <img src="img/ajax-loader.gif" class="ajax-loader"/>
+ </div>-->
+
+ <!-- In production use:
+ <script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script>
+ -->
+ <script type="text/javascript" src="../webjars/jquery/${jquery.version}/jquery.js"></script>
+ <script src="../webjars/angular/${angular.version}/angular.js"></script>
+ <script src="../webjars/angular-ui-router/${angular-ui-router.version}/angular-ui-router.js"></script>
+ <script src="../webjars/angular-animate/${angular-animate.version}/angular-animate.js"></script>
+ <script src="../webjars/angular-resource/${angular-resource.version}/angular-resource.js"></script>
+ <script src="../webjars/angular-cookies/${angular-cookies.version}/angular-cookies.js"></script>
+ <script src="../webjars/angular-sanitize/${angular-sanitize.version}/angular-sanitize.js"></script>
+ <script src="../webjars/angular-ui-bootstrap/${angular-ui-bootstrap.version}/ui-bootstrap-tpls.js"></script>
+ <script src="../webjars/angular-ui-select/${angular-ui-select.version}/select.js"></script>
+ <script src="../webjars/angular-growl-2/${angular-growl-2.version}/angular-growl.js"></script>
+ <script type="text/javascript" src="../webjars/bootstrap-select/${bootstrap-select.version}/js/bootstrap-select.min.js"></script>
+ <script src="../webjars/FileSaver.js/${FileSaver.version}/FileSaver.js" type="text/javascript"></script>
+ <!--main angular application-->
+ <script src="js/app.js"></script>
+ <!--services-->
+ <script src="js/services/authService.js"></script>
+ <script src="js/services/userSelfService.js"></script>
+ <script src="js/services/schemaService.js"></script>
+ <script src="js/services/realmService.js"></script>
+ <script src="js/services/securityQuestionService.js"></script>
+ <!--controllers-->
+ <script src="js/controllers/HomeController.js"></script>
+ <script src="js/controllers/LoginController.js"></script>
+ <script src="js/controllers/LanguageController.js"></script>
+ <script src="js/controllers/UserController.js"></script>
+ <!--directives-->
+ <script src="js/directives/dynamicAttribute.js"></script>
+ <script src="js/directives/dynamicPlainAttributes.js"></script>
+ <script src="js/directives/dynamicDerivedAttributes.js"></script>
+ <script src="js/directives/dynamicVirtualAttributes.js"></script>
+ <script src="js/directives/navigationButtons.js"></script>
+ <script src="js/directives/loader.js"></script>
+ <script src="js/directives/equals.js"></script>
+ <!--filters-->
+ <script src="js/filters/propsFilter.js"></script>
+
+
+ <link rel="shortcut icon" href="img/favicon.png" type="image/png"/>
+ <link href="css/login.css" rel="stylesheet" type="text/css" />
+ <link href="../webjars/jquery-ui/${jquery-ui.version}/jquery-ui.css" rel="stylesheet" type="text/css" />
+ <link href="../webjars/bootstrap/${bootstrap.version}/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
+ <link href="../webjars/bootstrap-select/${bootstrap-select.version}/css/bootstrap-select.min.css" rel="stylesheet" type="text/css" />
+ <link href="../webjars/font-awesome/${font-awesome.version}/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
+ <link href="../webjars/ionicons/${ionicons.version}/css/ionicons.min.css" rel="stylesheet" type="text/css" />
+ <link href="../webjars/angular-ui-select/${angular-ui-select.version}/select.css" rel="stylesheet" type="text/css"/>
+ <link href="../webjars/angular-growl-2/${angular-growl-2.version}/angular-growl.css" rel="stylesheet" type="text/css"/>
+ <link href="../webjars/select2/${select2.version}/select2.css" rel="stylesheet" type="text/css"/>
+ <link href="css/app.css" rel="stylesheet" type="text/css" />
+ <link href="css/login.css" rel="stylesheet" type="text/css" />
+ <link href="css/editUser.css" rel="stylesheet" type="text/css" />
+
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/app.js b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
new file mode 100644
index 0000000..1a53f00
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/app.js
@@ -0,0 +1,283 @@
+/**
+ 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.
+ **/
+
+'use strict';
+
+angular.module('home', []);
+angular.module('login', []);
+angular.module('language', []);
+angular.module('self', []);
+
+// Declare app level module which depends on views, and components
+var app = angular.module('SyncopeEnduserApp', [
+ 'ui.router',
+ 'ui.bootstrap',
+ 'ui.select',
+ 'ngSanitize',
+ 'ngAnimate',
+ 'ngResource',
+ 'ngCookies',
+ 'angular-growl',
+ 'home',
+ 'login',
+ 'language',
+ 'self'
+]);
+
+app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'growlProvider',
+ function ($stateProvider, $urlRouterProvider, $httpProvider, growlProvider) {
+ // route configuration
+ $stateProvider
+ .state('home', {
+ url: '/',
+ templateUrl: 'views/self.html'
+ })
+ .state('self', {
+ url: '/self',
+ templateUrl: 'views/self.html'
+ })
+ .state('user-self-update', {
+ url: '/user-self-update',
+ templateUrl: 'views/home.html',
+ controller: 'HomeController',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ .state('create', {
+ url: '/self/create',
+ templateUrl: 'views/editUser.html'
+ })
+ // nested states
+ // each of these sections will have their own view
+ // url will be nested (/self/create)
+ .state('create.credentials', {
+ url: '/credentials',
+ templateUrl: 'views/user-credentials.html'
+ })
+ .state('create.plainSchemas', {
+ url: '/plainSchemas',
+ templateUrl: 'views/user-plain-schemas.html'
+ })
+ .state('create.derivedSchemas', {
+ url: '/derivedSchemas',
+ templateUrl: 'views/user-derived-schemas.html'
+ })
+ .state('create.virtualSchemas', {
+ url: '/virtualSchemas',
+ templateUrl: 'views/user-virtual-schemas.html'
+ })
+ // url will be /self/create/schema
+ .state('create.groups', {
+ url: '/groups',
+ templateUrl: 'views/user-groups.html'
+ })
+ .state('create.resources', {
+ url: '/resources',
+ templateUrl: 'views/user-resources.html'
+ })
+ .state('update', {
+ url: '/self/update',
+ templateUrl: 'views/editUser.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ // nested states
+ // each of these sections will have their own view
+ // url will be nested (/self/create)
+ .state('update.credentials', {
+ url: '/credentials',
+ templateUrl: 'views/user-credentials.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ .state('update.plainSchemas', {
+ url: '/plainSchemas',
+ templateUrl: 'views/user-plain-schemas.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ .state('update.derivedSchemas', {
+ url: '/derivedSchemas',
+ templateUrl: 'views/user-derived-schemas.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ .state('update.virtualSchemas', {
+ url: '/virtualSchemas',
+ templateUrl: 'views/user-virtual-schemas.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ // url will be /self/create/schema
+ .state('update.groups', {
+ url: '/groups',
+ templateUrl: 'views/user-groups.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ })
+ .state('update.resources', {
+ url: '/resources',
+ templateUrl: 'views/user-resources.html',
+ resolve: {
+ 'authenticated': function (AuthenticationHelper) {
+ return AuthenticationHelper.authenticated();
+ }
+ }
+ });
+
+ // catch all other routes
+ // send users to the home page
+ $urlRouterProvider.otherwise('/');
+
+ // HTTP service configuration
+ $httpProvider.defaults.withCredentials = true;
+
+ $httpProvider.interceptors.push(function ($q, $rootScope, $location) {
+ var numLoadings = 0;
+ return {
+// 'request': function (config) {
+// numLoadings++;
+// // Show loader
+// if (config.url.indexOf("skipLoader=true") == -1) {
+// $rootScope.$broadcast("loader_show");
+// }
+// return config || $q.when(config);
+// },
+// 'response': function (response) {
+// if ((--numLoadings) === 0) {
+// // Hide loader
+// $rootScope.$broadcast("loader_hide");
+// }
+// return response || $q.when(response);
+// },
+ 'responseError': function (response) {
+ if (response.config.url.indexOf("acceptError=true") == -1) {
+ var status = response.status;
+ if (status == 401) {
+ console.log("ERROR " + status);
+// $location.path("/self");
+ }
+ if (status == 403) {
+ console.log("UNAUTHORIZED " + status);
+// $location.path("/self");
+ }
+ if (status == 400 || status == 404 || status == 412 || status == 500) {
+// if (response.data.validationErrors != undefined) {
+// for (var i in response.data.validationErrors) {
+// $rootScope.$broadcast('growlMessage', {text: response.data.validationErrors[i] || '', severity: 'error'});
+// }
+// } else if (response.data.message != undefined) {
+// $rootScope.$broadcast('growlMessage', {text: response.data.message || '', severity: 'error'})
+// }
+ console.log("GENERIC ERROR " + status);
+ }
+ }
+ return $q.reject(response);
+ }
+ };
+ });
+
+ growlProvider.globalTimeToLive(10000);
+ growlProvider.globalPosition('bottom-left');
+ growlProvider.globalInlineMessages(true);
+ growlProvider.globalDisableIcons(true);
+ //to enable html in growl
+// growlProvider.globalEnableHtml(true);
+ }]);
+
+app.run(['$rootScope', '$location', '$cookies', '$state',
+ function ($rootScope, $location, $cookies, $state) {
+ // main program
+ // keep user logged in after page refresh
+ // check if user is logged or not
+ $rootScope.currentUser = $cookies.get('currentUser') || null;
+//If the route change failed due to authentication error, redirect them out
+ $rootScope.$on('$routeChangeError', function (event, current, previous, rejection) {
+ if (rejection === 'Not Authenticated') {
+ $location.path('/self');
+ }
+ });
+
+// $rootScope.$on('success', function (event, args) {
+// console.log("IN CONFIG EVENTO: ", event);
+// $rootScope.$broadcast("error", "success");
+// });
+
+ $rootScope.$on('$stateChangeSuccess', function (event, toState) {
+ if (toState.name === 'create') {
+ $state.go('create.credentials');
+ } else if (toState.name === 'update') {
+ $state.go('update.credentials');
+ }
+ });
+// $rootScope.$on('$locationChangeStart', function (event, next, current) {
+// // redirect to login page if not logged in
+// if ($location.path() !== '/self' && !$rootScope.globals.currentUser) {
+// $location.path('/self');
+// }
+// });
+ }]);
+
+app.controller('ApplicationController', function ($scope) {
+// DO NOTHING
+// $scope.$on('success', function (event, args) {
+// console.log("IN CONFIG EVENTO: ", event)
+// $scope.$broadcast("error", "success");
+// });
+});
+
+app.factory('AuthenticationHelper', ['$q', '$rootScope',
+ function ($q, $rootScope) {
+ return {
+ authenticated: function () {
+
+ var currentUser = $rootScope.currentUser;
+
+ console.log("AuthenticationHelper, currentUser: ", currentUser);
+
+ if (angular.isDefined(currentUser) && currentUser) {
+ return true;
+ } else {
+ console.log("NOT AUTHENTICATED, REDIRECT TO LOGIN PAGE");
+ return $q.reject('Not Authenticated');
+ }
+ }
+ };
+ }]);
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/HomeController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/HomeController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/HomeController.js
new file mode 100644
index 0000000..bf86413
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/HomeController.js
@@ -0,0 +1,39 @@
+/**
+ 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.
+ **/
+
+'use strict';
+
+angular.module("home").controller("HomeController", ['$scope', '$http', '$location', function ($scope, $http, $location) {
+ $scope.title = 'Hello world!';
+ $scope.subtitle = 'Hello world SUBTITLE!';
+ $scope.name = "";
+
+// check if user is logged or not, check session variables: if user isn't logged redirect to login page
+
+ console.log("SONO IN HomeController");
+
+// var isLogged = false;
+// if (!isLogged) {
+// console.log("REDIRECT TO LOGIN PAGE");
+//// window.location = "./self.html";
+// $location.path("/self");
+// }
+
+
+ }]);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LanguageController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LanguageController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LanguageController.js
new file mode 100644
index 0000000..9e1fa6c
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LanguageController.js
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('language')
+ .controller('LanguageController', function ($scope) {
+
+ $scope.languages = {
+ availableLanguages: [
+ {id: '1', name: 'Italiano'},
+ {id: '2', name: 'English'},
+ {id: '3', name: 'Portugese'}
+ ],
+ selectedLanguage: {id: '2', name: 'English'}
+ };
+
+ $scope.init = function () {
+// MainService.settings().then(function (response) {
+// $scope.mainSettings = response;
+// });
+
+ console.log("Init language controller");
+ };
+
+ $scope.changeLanguage = function (language) {
+
+ console.log("Language changed to: ", language);
+
+ $scope.languages.selectedLanguage = language;
+
+// $translate.use(langKey);
+// LanguageService.switchLocale.query({language: langKey}, {}, function (response) {
+// $scope.selectedLanguage.locale = langKey;
+// });
+ };
+
+ this.retrieveLanguages = function () {
+// LanguageService.language.query({}, function (response) {
+// $scope.languages = response;
+// });
+ console.log("Retriebìving available languages");
+ };
+
+
+ this.retrieveLanguages();
+
+
+ });
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
new file mode 100644
index 0000000..c962571
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/LoginController.js
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module("login").controller("LoginController", ['$scope', '$rootScope', '$http', '$location', '$cookies',
+ 'AuthService', 'growl', function ($scope, $rootScope, $http, $location, $cookies, AuthService, growl) {
+
+ $scope.credentials = {
+ username: '',
+ password: '',
+ errorMessage: ''
+ };
+
+ $scope.login = function (credentials) {
+
+ console.log("CREDENTIALS FROM PAGE: ", credentials);
+ console.log("AUTHSERVICE: ", AuthService);
+
+ AuthService.login($scope.credentials).then(function (user) {
+ console.log("LOGIN SUCCESS FOR: ", user);
+ console.log("DOPO AVER SETTATO CURRENT USER: ", $rootScope.currentUser);
+ console.log("COOKIE CURRENT USER: ", $cookies.get('currentUser'));
+ // reset error message
+ $scope.credentials.errorMessage = '';
+ // got to update page
+ $location.path("/self/update");
+ }, function (response) {
+ console.log("LOGIN FAILED: ", response);
+ $scope.credentials.errorMessage = "Login failed: " + response;
+ growl.error($scope.credentials.errorMessage, {referenceId: 1});
+ });
+ };
+
+ $scope.logout = function () {
+
+ console.log("PERFORMING LOGOUT");
+
+ AuthService.logout().then(function (response) {
+ console.log("LOGOUT SUCCESS: ", response);
+ }, function () {
+ console.log("LOGOUT FAILED");
+ });
+ };
+
+ $scope.isLogged = function () {
+ return angular.isDefined($rootScope.currentUser) && $rootScope.currentUser;
+ };
+
+ $scope.selfCreate = function () {
+ $location.path("/self/create");
+ };
+
+ $scope.passwordReset = function () {
+ // TODO
+ console.log("NOT YET IMPLEMENTED")
+ };
+
+ $scope.errorAPI = function () {
+ $http.get("/syncope-enduser/api/error").success(function (data) {
+ console.log("errorAPI response: ", data);
+ });
+ };
+
+ $scope.sampleAPI = function () {
+ $http.get("/syncope-enduser/api/user-self").success(function (data) {
+ console.log("sampleAPI response: ", data);
+ });
+ };
+
+ $scope.schemaAPI = function () {
+ $http.get("/syncope-enduser/api/schema").success(function (data) {
+ console.log("schemaAPI response: ", data);
+ });
+ };
+
+ }]);
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
new file mode 100644
index 0000000..892de21
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/controllers/UserController.js
@@ -0,0 +1,206 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module("self").controller("UserController", ['$scope', '$rootScope', '$location', 'AuthService',
+ 'UserSelfService', 'SchemaService', 'RealmService', 'SecurityQuestionService', 'growl', function ($scope, $rootScope,
+ $location, AuthService, UserSelfService, SchemaService, RealmService, SecurityQuestionService, growl) {
+
+ $scope.user = {};
+ $scope.confirmPassword = {
+ value: ''
+ };
+ $scope.userFormValid = false;
+ $scope.createMode = $location.path().indexOf("/self/create") > -1;
+
+ $scope.availableRealms = [];
+ $scope.availableSecurityQuestions = [];
+
+ $scope.initialSecurityQuestion = undefined;
+
+ $scope.initUser = function () {
+
+ $scope.dynamicForm = {
+ plainSchemas: [],
+ derSchemas: [],
+ virSchemas: [],
+ selectedDerSchemas: [],
+ selectedVirSchemas: [],
+ errorMessage: '',
+ attributeTable: {}
+ };
+
+
+ var initSchemas = function () {
+ // initialization is done here synchronously to have all schema fields populated correctly
+ SchemaService.getUserSchemas().then(function (schemas) {
+ $scope.dynamicForm.plainSchemas = schemas.plainSchemas;
+ $scope.dynamicForm.derSchemas = schemas.derSchemas;
+ $scope.dynamicForm.virSchemas = schemas.virSchemas;
+
+ // initialize plain attributes
+ for (var i = 0; i < schemas.plainSchemas.length; i++) {
+
+ var plainSchemaKey = schemas.plainSchemas[i].key;
+
+ if (!$scope.user.plainAttrs[plainSchemaKey]) {
+
+ $scope.user.plainAttrs[plainSchemaKey] = {
+ schema: plainSchemaKey,
+ values: [],
+ readonly: schemas.plainSchemas[i].readonly
+ };
+
+ // initialize multivalue schema and support table: create mode, only first value
+ if (schemas.plainSchemas[i].multivalue) {
+ $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key] = {
+ fields: [schemas.plainSchemas[i].key + "_" + 0]
+ };
+ }
+ } else {
+ // initialize multivalue schema and support table: update mode, all provided values
+ if (schemas.plainSchemas[i].multivalue) {
+ $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key] = {
+ fields: [schemas.plainSchemas[i].key + "_" + 0]
+ };
+ // add other values
+ for (var j = 1; j < $scope.user.plainAttrs[plainSchemaKey].values.length; j++) {
+ $scope.dynamicForm.attributeTable[schemas.plainSchemas[i].key].fields.push(schemas.plainSchemas[i].key + "_" + j);
+ }
+ }
+ }
+ }
+
+ // initialize derived attributes
+ for (var i = 0; i < schemas.derSchemas.length; i++) {
+
+ var derSchemaKey = schemas.derSchemas[i].key;
+
+ if ($scope.user.derAttrs[derSchemaKey]) {
+ $scope.dynamicForm.selectedDerSchemas.push(schemas.derSchemas[i]);
+ }
+ }
+
+ // initialize virtual attributes
+ for (var i = 0; i < schemas.virSchemas.length; i++) {
+
+ var virSchemaKey = schemas.virSchemas[i].key;
+
+ if ($scope.user.virAttrs[virSchemaKey]) {
+ $scope.dynamicForm.selectedVirSchemas.push(schemas.virSchemas[i]);
+ }
+ }
+
+ }, function () {
+ console.log("Error retrieving user schemas");
+ });
+ console.log("USER WITH ATTRTO: ", $scope.user);
+
+ };
+
+ var initSecurityQuestions = function () {
+ SecurityQuestionService.getAvailableSecurityQuestions().then(function (response) {
+ $scope.availableSecurityQuestions = response;
+ }, function () {
+ console.log("Error");
+ });
+ };
+
+ var initRealms = function () {
+ $scope.availableRealms = RealmService.getAvailableRealmsStub();
+ };
+
+ var initUserRealm = function () {
+ $scope.user.realm = RealmService.getUserRealm();
+ };
+
+
+ var readUser = function () {
+ UserSelfService.read().then(function (response) {
+ $scope.user = response;
+ $scope.user.password = undefined;
+ $scope.initialSecurityQuestion = $scope.user.securityQuestion;
+ }, function () {
+ console.log("Error");
+ });
+ };
+
+ if ($scope.createMode) {
+
+ $scope.user = {
+ username: '',
+ password: '',
+ realm: '',
+ securityQuestion: undefined,
+ securityAnswer: '',
+ plainAttrs: {},
+ derAttrs: {},
+ virAttrs: {}
+ };
+
+ // retrieve user realm or all available realms
+ initUserRealm();
+
+ } else {
+
+ // read user from syncope core
+ readUser();
+ // read user security question
+
+ }
+
+ initRealms();
+ //retrieve security available questions
+ initSecurityQuestions();
+ // initialize user attributes starting from any object schemas
+ initSchemas();
+
+ };
+
+ $scope.saveUser = function (user) {
+ console.log("Save user: ", user);
+
+ if ($scope.createMode) {
+
+ UserSelfService.create(user).then(function (response) {
+ console.log("Created user: ", response);
+ growl.success("User " + $scope.user.username + " successfully created", {referenceId: 1});
+ $location.path('/self');
+ }, function (response) {
+ console.log("Error during user creation: ", response);
+ growl.error("Error: " + response, {referenceId: 2});
+ });
+
+ } else {
+
+ UserSelfService.update(user).then(function (response) {
+ console.log("Updated user: ", response);
+ growl.success("User " + $scope.user.username + " successfully updated", {referenceId: 1});
+ $location.path('/self');
+ }, function (response) {
+ console.log("Error during user update: ", response);
+ growl.error("Error: " + response, {referenceId: 2});
+ });
+ }
+ };
+
+
+
+ }]);
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicAttribute.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicAttribute.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicAttribute.js
new file mode 100644
index 0000000..6a00507
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicAttribute.js
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ */
+'use strict';
+
+angular.module('self')
+ .directive('dynamicAttribute', function ($filter) {
+ return {
+ restrict: 'E',
+ templateUrl: 'views/dynamicAttribute.html',
+ scope: {
+ schema: "=",
+ index: "=",
+ user: "="
+ },
+ controller: function ($scope, $element, $window) {
+ $scope.initAttribute = function (schema, index) {
+
+ switch (schema.type) {
+ case "Long":
+ case "Double":
+ $scope.user.plainAttrs[schema.key].values[index] = Number($scope.user.plainAttrs[schema.key].values[index])
+ || undefined;
+ break;
+ case "Enum":
+ $scope.enumerationValues = [];
+ var enumerationValuesSplitted = schema.enumerationValues.toString().split(";");
+ for (var i = 0; i < enumerationValuesSplitted.length; i++) {
+ $scope.enumerationValues.push(enumerationValuesSplitted[i]);
+ }
+ $scope.user.plainAttrs[schema.key].values[index] = $scope.user.plainAttrs[schema.key].values[index]
+ || $scope.enumerationValues[0];
+ break;
+ case "Binary":
+
+ $scope.userFile = $scope.userFile || '';
+ //for multivalue fields
+// $scope.fileInputId = "fileInputId_" + index;
+
+ $element.bind("change", function (changeEvent) {
+ $scope.$apply(function () {
+ var reader = new FileReader();
+ var file = changeEvent.target.files[0];
+ $scope.userFile = file.name;
+ reader.onload = function (readerEvt) {
+ var binaryString = readerEvt.target.result;
+ $scope.user.plainAttrs[schema.key].values[index] = btoa(binaryString);
+ };
+ reader.readAsBinaryString(file);
+ });
+ });
+
+ $scope.download = function () {
+ var byteString = atob($scope.user.plainAttrs[schema.key].values[index]);
+
+ var ab = new ArrayBuffer(byteString.length);
+ var ia = new Uint8Array(ab);
+ for (var i = 0; i < byteString.length; i++) {
+ ia[i] = byteString.charCodeAt(i);
+ }
+
+ var blob = new Blob([ia], {type: schema.mimeType});
+
+ saveAs(blob, schema.key);
+ };
+ $scope.remove = function () {
+ $scope.user.plainAttrs[schema.key].values.splice(index, 1);
+ $scope.userFile = '';
+ $("#fileInput").replaceWith($("#fileInput").clone(true));
+ };
+ break;
+ case "Date":
+
+ $scope.selectedDate = $scope.user.plainAttrs[schema.key].values[index];
+ $scope.format = $scope.schema.conversionPattern;
+ $scope.includeTimezone = false;
+ if ($scope.schema.conversionPattern.indexOf(".SSS") > -1) {
+ $scope.format = $scope.format.replace(".SSS", ".sss");
+ }
+ if ($scope.schema.conversionPattern.indexOf("Z") > -1) {
+ $scope.includeTimezone = true;
+ $scope.format = $scope.format.replace("Z", "");
+ }
+ if ($scope.schema.conversionPattern.indexOf("\'") > -1) {
+ $scope.format = $scope.format.replace(new RegExp("\'", "g"), "");
+ }
+
+ $scope.bindDateToModel = function (selectedDate, format) {
+ var newFormat = $scope.includeTimezone ? format.concat(" Z") : format;
+ if (selectedDate) {
+ selectedDate = $filter('date')(selectedDate, newFormat);
+ var dateGood = selectedDate.toString();
+ $scope.user.plainAttrs[schema.key].values[index] = dateGood;
+ } else {
+ $scope.user.plainAttrs[schema.key].values[index] = selectedDate;
+ }
+ };
+
+ $scope.clear = function () {
+ $scope.user.plainAttrs[schema.key].values[index] = null;
+ };
+
+ // Disable weekend selection
+ $scope.disabled = function (date, mode) {
+ // example if you want to disable weekends
+ // return (mode === 'day' && (date.getDay() === 0 || date.getDay() === 6));
+ return false;
+ };
+
+ $scope.toggleMin = function () {
+ $scope.minDate = $scope.minDate ? null : new Date();
+ };
+
+ $scope.maxDate = new Date(2050, 5, 22);
+
+ $scope.open = function ($event) {
+ $scope.status.opened = true;
+ };
+
+ $scope.setDate = function (year, month, day) {
+ $scope.user.plainAttrs[schema.key].values[index] = new Date(year, month, day);
+ };
+
+ $scope.dateOptions = {
+ startingDay: 1
+ };
+
+ $scope.status = {
+ opened: false
+ };
+
+ var tomorrow = new Date();
+ tomorrow.setDate(tomorrow.getDate() + 1);
+ var afterTomorrow = new Date();
+ afterTomorrow.setDate(tomorrow.getDate() + 2);
+ $scope.events =
+ [
+ {
+ date: tomorrow,
+ status: 'full'
+ },
+ {
+ date: afterTomorrow,
+ status: 'partially'
+ }
+ ];
+
+ $scope.getDayClass = function (date, mode) {
+ if (mode === 'day') {
+ var dayToCheck = new Date(date).setHours(0, 0, 0, 0);
+
+ for (var i = 0; i < $scope.events.length; i++) {
+ var currentDay = new Date($scope.events[i].date).setHours(0, 0, 0, 0);
+
+ if (dayToCheck === currentDay) {
+ return $scope.events[i].status;
+ }
+ }
+ }
+
+ };
+ break;
+
+ case "Boolean":
+ $scope.user.plainAttrs[schema.key].values[index] =
+ Boolean($scope.user.plainAttrs[schema.key].values[index]) || false;
+ break;
+
+ }
+ }
+ ;
+ },
+ replace: true
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
new file mode 100644
index 0000000..887b5c6
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicDerivedAttributes.js
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+'use strict';
+
+angular.module('self')
+ .directive('dynamicDerivedAttributes', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'views/dynamicDerivedAttributes.html',
+ scope: {
+ dynamicForm: "=form",
+ user: "="
+ },
+ controller: function ($scope) {
+
+ $scope.addDerivedAttribute = function (item, model) {
+ var derSchemaKey = item.key;
+ console.log("ADDING DERIVED item: ", derSchemaKey);
+ $scope.user.derAttrs[derSchemaKey] = {
+ schema: derSchemaKey,
+ values: [],
+ readonly: false
+ };
+
+ };
+
+ $scope.removeDerivedAttribute = function (item, model) {
+ var derSchemaKey = item.key;
+ console.log("REMOVING DERIVED item: ", derSchemaKey);
+ delete $scope.user.derAttrs[derSchemaKey];
+
+ };
+
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
new file mode 100644
index 0000000..1a0a4c3
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicPlainAttributes.js
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+'use strict';
+
+angular.module('self')
+ .directive('dynamicPlainAttributes', function (SchemaService) {
+ return {
+ restrict: 'E',
+ templateUrl: 'views/dynamicPlainAttributes.html',
+ scope: {
+ dynamicForm: "=form",
+ user: "="
+ },
+ controller: function ($scope) {
+
+ $scope.addAttributeField = function (plainSchemaKey) {
+ console.log("ADDING: ", plainSchemaKey + "_" + ($scope.dynamicForm.attributeTable[plainSchemaKey].fields.length));
+ $scope.dynamicForm.attributeTable[plainSchemaKey].fields.push(plainSchemaKey + "_" + ($scope.dynamicForm.attributeTable[plainSchemaKey].fields.length));
+ };
+
+ $scope.removeAttributeField = function (plainSchemaKey, index) {
+ console.log("REMOVING FROM: " + plainSchemaKey + " ATTRIBUTE INDEX: " + index);
+ $scope.dynamicForm.attributeTable[plainSchemaKey].fields.splice(index, 1);
+ // clean user model
+ $scope.user.plainAttrs[plainSchemaKey].values.splice(index, 1);
+ };
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
new file mode 100644
index 0000000..62c1591
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/dynamicVirtualAttributes.js
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+'use strict';
+
+angular.module('self')
+ .directive('dynamicVirtualAttributes', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'views/dynamicVirtualAttributes.html',
+ scope: {
+ dynamicForm: "=form",
+ user: "="
+ },
+ controller: function ($scope) {
+
+ $scope.addVirtualAttribute = function (item, model) {
+ var virSchemaKey = item.key;
+ console.log("ADDING VIRTUAL item: ", virSchemaKey);
+ $scope.user.virAttrs[virSchemaKey] = {
+ schema: virSchemaKey,
+ values: [],
+ readonly: false
+ };
+
+ };
+
+ $scope.removeVirtualAttribute = function (item, model) {
+ var virSchemaKey = item.key;
+ console.log("REMOVING VIRTUAL item: ", virSchemaKey);
+ delete $scope.user.virAttrs[virSchemaKey];
+
+ };
+
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/equals.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/equals.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/equals.js
new file mode 100644
index 0000000..54c2022
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/equals.js
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+angular.module('self')
+ .directive('equals', function () {
+ return {
+ restrict: 'A',
+ require: '?ngModel',
+ link: function (scope, elem, attrs, ngModel) {
+ if (!ngModel)
+ return; // do nothing if no ng-model
+
+ // watch own value and re-validate on change
+ scope.$watch(attrs.ngModel, function () {
+ validate();
+ });
+
+ // observe the other value and re-validate on change
+ attrs.$observe('equals', function (val) {
+ validate();
+ });
+
+ var validate = function () {
+ // values
+ var val1 = ngModel.$viewValue;
+ var val2 = attrs.equals;
+
+ // set validity
+ ngModel.$setValidity('equals', !val1 || !val2 || val1 === val2);
+ };
+ }
+ };
+ });
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/loader.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/loader.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/loader.js
new file mode 100644
index 0000000..603fb34
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/loader.js
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('SyncopeEnduserApp')
+ .directive("loader", function ($rootScope) {
+ return function ($scope, element, attrs) {
+ $scope.$on("loader_show", function () {
+ return element.show();
+ });
+ return $scope.$on("loader_hide", function () {
+ return element.hide();
+ });
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
new file mode 100644
index 0000000..ff3eebf
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/navigationButtons.js
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+'use strict';
+
+angular.module('self')
+ .directive('navigationButtons', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'views/navigationButtons.html',
+ scope: {
+ next: "@",
+ previous: "@"
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/directives/passwordStrengthEstimator.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/directives/passwordStrengthEstimator.js b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/passwordStrengthEstimator.js
new file mode 100644
index 0000000..4bf52b2
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/directives/passwordStrengthEstimator.js
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+'use strict'
+
+angular.module('self', [])
+ .directive('checkStrength', function () {
+ return {
+ replace: false,
+ restrict: 'EACM',
+ link: function (scope, iElement, iAttrs) {
+
+ var strength = {
+ colors: ['#F00', '#F90', '#FF0', '#9F0', '#0F0'],
+ mesureStrength: function (p) {
+
+ var _force = 0;
+ var _regex = /[$-/:-?{-~!"^_`\[\]]/g;
+
+ var _lowerLetters = /[a-z]+/.test(p);
+ var _upperLetters = /[A-Z]+/.test(p);
+ var _numbers = /[0-9]+/.test(p);
+ var _symbols = _regex.test(p);
+
+ var _flags = [_lowerLetters, _upperLetters, _numbers, _symbols];
+ var _passedMatches = $.grep(_flags, function (el) {
+ return el === true;
+ }).length;
+
+ _force += 2 * p.length + ((p.length >= 10) ? 1 : 0);
+ _force += _passedMatches * 10;
+
+ // penality (short password)
+ _force = (p.length <= 6) ? Math.min(_force, 10) : _force;
+
+ // penality (poor variety of characters)
+ _force = (_passedMatches == 1) ? Math.min(_force, 10) : _force;
+ _force = (_passedMatches == 2) ? Math.min(_force, 20) : _force;
+ _force = (_passedMatches == 3) ? Math.min(_force, 40) : _force;
+
+ return _force;
+
+ },
+ getColor: function (s) {
+
+ var idx = 0;
+ if (s <= 10) {
+ idx = 0;
+ }
+ else if (s <= 20) {
+ idx = 1;
+ }
+ else if (s <= 30) {
+ idx = 2;
+ }
+ else if (s <= 40) {
+ idx = 3;
+ }
+ else {
+ idx = 4;
+ }
+
+ return {idx: idx + 1, col: this.colors[idx]};
+
+ }
+ };
+
+ scope.$watch(iAttrs.checkStrength, function () {
+ if (scope.pw === '') {
+ iElement.css({"display": "none"});
+ } else {
+ var strength = strength.mesureStrength(scope.pw);
+ var c = strength.getColor(strength);
+ iElement.css({"display": "inline"});
+ iElement.children('li')
+ .css({"background": "#DDD"})
+ .slice(0, c.idx)
+ .css({"background": c.col});
+ }
+ });
+
+ },
+ template: ''
+ };
+ });
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/filters/propsFilter.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/filters/propsFilter.js b/client/enduser/src/main/resources/META-INF/resources/app/js/filters/propsFilter.js
new file mode 100644
index 0000000..a092d0c
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/filters/propsFilter.js
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+'use strict'
+
+angular.module("self")
+ .filter('propsFilter', function () {
+ return function (items, props) {
+ var out = [];
+
+ if (angular.isArray(items)) {
+ items.forEach(function (item) {
+ var itemMatches = false;
+
+ var keys = Object.keys(props);
+ for (var i = 0; i < keys.length; i++) {
+ var prop = keys[i];
+ var text = props[prop].toLowerCase();
+ if (item[prop].toString().toLowerCase().indexOf(text) !== -1) {
+ itemMatches = true;
+ break;
+ }
+ }
+
+ if (itemMatches) {
+ out.push(item);
+ }
+ });
+ } else {
+ // Let the output be the input untouched
+ out = items;
+ }
+
+ return out;
+ };
+ });
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
new file mode 100644
index 0000000..3c3f7af
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/authService.js
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('login')
+ .factory('AuthService', ['$rootScope', '$resource', '$q', '$http', '$cookies',
+ function ($rootScope, $resource, $q, $http, $cookies) {
+
+ var authService = {};
+
+ var clearUserCookie = function () {
+ $rootScope.currentUser = null;
+ $cookies.remove('currentUser');
+ };
+
+ authService.login = function (credentials) {
+ return $http
+ .post('/syncope-enduser/api/login', credentials)
+ .then(function (response) {
+ var username = response.data;
+ $cookies.put('currentUser', username);
+ $rootScope.currentUser = username;
+ return username;
+ }, function (response) {
+ clearUserCookie();
+ console.log("Something went wrong during login, exit with status: ", response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+
+ authService.logout = function () {
+ return $http
+ .get('/syncope-enduser/api/logout')
+ .then(function (response) {
+ clearUserCookie();
+ return response;
+ }, function (response) {
+ clearUserCookie();
+ console.log("Something went wrong during logout, exit with status: ", response);
+ });
+ };
+
+ return authService;
+// return {
+// login: $resource('/syncope-enduser/api/login', {}, {
+// do: {method: 'POST', params: {}, isArray: false}
+// })
+// };
+// return {
+// logout: $resource('/cradleDashboard/api/logout', {}, {
+// query: {method: 'GET', params: {}, isArray: false}
+// })
+// };
+
+ }]);
+
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/services/realmService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/realmService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/realmService.js
new file mode 100644
index 0000000..356dc87
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/realmService.js
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('self')
+ .factory('RealmService', ['$resource', '$q', '$http',
+ function ($resource, $q, $http) {
+
+ var realmService = {};
+
+ realmService.getAvailableRealmsStub = function () {
+ return ["/"];
+ };
+
+ realmService.getAvailableRealms = function () {
+ return $http.get("/syncope-enduser/api/realms")
+ .then(function (response) {
+ console.log("realms response: ", response);
+ return response.data;
+ }, function (response) {
+ console.log("Something went wrong during realms retrieval, exit with status: ", response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+
+ realmService.getUserRealm = function () {
+ return "/";
+ };
+ return realmService;
+ }]);
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/services/schemaService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/schemaService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/schemaService.js
new file mode 100644
index 0000000..be9f510
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/schemaService.js
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('self')
+ .factory('SchemaService', ['$resource', '$q', '$http',
+ function ($resource, $q, $http) {
+
+ var schemaService = {};
+
+ schemaService.getUserSchemas = function () {
+
+ return $http.get("/syncope-enduser/api/schemas")
+ .then(function (response) {
+ console.log("schemaAPI response: ", response);
+ return response.data;
+ }, function (response) {
+ console.log("Something went wrong during schema retrieval, exit with status: ", response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+ return schemaService;
+ }]);
+
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/services/securityQuestionService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/securityQuestionService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/securityQuestionService.js
new file mode 100644
index 0000000..ff91f18
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/securityQuestionService.js
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('self')
+ .factory('SecurityQuestionService', ['$resource', '$q', '$http',
+ function ($resource, $q, $http) {
+
+ var securityQuestionService = {};
+
+ securityQuestionService.getAvailableSecurityQuestions = function () {
+ return $http.get("/syncope-enduser/api/securityQuestions")
+ .then(function (response) {
+ console.log("security questions response: ", response);
+ return response.data;
+ }, function (response) {
+ console.log("Something went wrong during security questions retrieval, exit with status: ",
+ response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+
+ return securityQuestionService;
+ }]);
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js b/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
new file mode 100644
index 0000000..3a99e7f
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/js/services/userSelfService.js
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+'use strict';
+
+angular.module('login')
+ .factory('UserSelfService', ['$resource', '$q', '$http',
+ function ($resource, $q, $http) {
+
+ var userSelfService = {};
+
+ userSelfService.read = function () {
+ return $http
+ .get('/syncope-enduser/api/self/read')
+ .then(function (response) {
+ console.log("response read: ", response.data);
+ return response.data;
+ }, function (response) {
+ console.log("Something went wrong during user self read, exit with status: ", response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+
+ userSelfService.create = function (user) {
+ return $http
+ .post('/syncope-enduser/api/self/create', user)
+ .then(function (response) {
+ console.log("response save: ", response)
+ var username = response;
+ }, function (response) {
+ console.log("Something went wrong during user self creation, exit with status: ", response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+
+ userSelfService.update = function (user) {
+ return $http
+ .post('/syncope-enduser/api/self/update', user)
+ .then(function (response) {
+ var username = response;
+ }, function (response) {
+ console.log("Something went wrong during user self update, exit with status: ", response);
+ return $q.reject(response.data || response.statusText);
+ });
+ };
+
+ userSelfService.passwordReset = function () {
+ };
+
+ return userSelfService;
+ }]);
+
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicAttribute.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicAttribute.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicAttribute.html
new file mode 100644
index 0000000..9c6b1d9
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicAttribute.html
@@ -0,0 +1,58 @@
+<div ng-switch="schema.type" >
+ <input ng-switch-when="String" class="form-control" type="text"
+ ng-model="user.plainAttrs[schema.key].values[index]"
+ ng-required="schema.mandatoryCondition"
+ ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/>
+ <input ng-switch-when="Encrypted" class="form-control" type="text"
+ ng-model="user.plainAttrs[schema.key].values[index]"
+ ng-required="schema.mandatoryCondition"
+ ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/>
+ <div ng-switch-when="Boolean">
+ <input type="checkbox" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="schema.mandatoryCondition"
+ ng-init="initAttribute(schema, index)" />
+ </div>
+ <input ng-switch-when="Long" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="schema.mandatoryCondition"
+ ng-init="initAttribute(schema, index)" />
+ <input ng-switch-when="Double" class="form-control" type="number" ng-model="user.plainAttrs[schema.key].values[index]" ng-required="schema.mandatoryCondition"
+ ng-init="initAttribute(schema, index)" />
+ <p ng-switch-when="Date" class="input-group" >
+ <input type="text" class="form-control"
+ uib-datepicker-popup="{{format}}"
+ ng-model="selectedDate"
+ ng-change="bindDateToModel(selectedDate, format)"
+ min-date="minDate" max-date="maxDate"
+ is-open="status.opened" datepicker-options="dateOptions"
+ ng-required="schema.mandatoryCondition" close-text="Close" ng-init="initAttribute(schema, index)"/>
+ <span class="input-group-btn">
+ <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
+ </span>
+ </p>
+
+ <div ng-switch-when="Enum" ng-init="initAttribute(schema, index)">
+ <select class="form-control"
+ ng-model="user.plainAttrs[schema.key].values[index]"
+ ng-required="schema.mandatoryCondition">
+ <option ng-repeat="value in enumerationValues" value="{{value}}">{{schema.enumerationKeys[$index] || value}}</option>
+ </select>
+ </div>
+
+ <div ng-switch-when="Binary" ng-init="initAttribute(schema, index)">
+ <div enctype="multipart/form-data" accept-charset="UTF-8">
+ <input id="fileInput" type="file" ng-required="schema.mandatoryCondition"/>
+ <button type="button" title="Download file" class="fileButton btn btn-default btn-sm" ng-click="download()">
+ <i class="glyphicon glyphicon-download" ></i>
+ </button>
+ <button type="button" class="fileButton btn btn-default btn-sm" title="Remove file" ng-click="remove()">
+ <i class="glyphicon glyphicon-remove-sign" ></i>
+ </button>
+ <h4><span class="label label-primary" ng-model="userFile">{{userFile}}</span></h4>
+ </div>
+
+ </div>
+
+ <input ng-switch-default class="form-control" type="text"
+ ng-model="user.plainAttrs[schema.key].values[index]"
+ ng-required="schema.mandatoryCondition"
+ ng-disabled="schema.readonly" ng-init="initAttribute(schema, index)"/>
+
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
new file mode 100644
index 0000000..9400877
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicDerivedAttributes.html
@@ -0,0 +1,21 @@
+<ui-select on-select="addDerivedAttribute($item, $model)" on-remove="removeDerivedAttribute($item, $model)" multiple
+ ng-model="dynamicForm.selectedDerSchemas" theme="select2" class="attribute-ui-select">
+ <ui-select-match placeholder="Select derived attribute...">{{$item.key}}</ui-select-match>
+ <ui-select-choices repeat="derSchema in dynamicForm.derSchemas | propsFilter: {key: $select.search}">
+ <div ng-bind-html="derSchema.key | highlight: $select.search"></div>
+ <small>
+ name: {{derSchema.key}}
+ expression: {{derSchema.expression}}
+ </small>
+ </ui-select-choices>
+</ui-select>
+
+<ul class="attribute-virtual-value-container">
+ <li class="attribute-virtual-value-field" ng-repeat="selectedDerSchema in dynamicForm.selectedDerSchemas| filter:q as results">
+ {{selectedDerSchema.key}}
+ <input style="font-weight: normal" class="form-control" type="text" ng-disabled="true" ng-model="user.derAttrs[selectedDerSchema.key].values[0]"/>
+ </li>
+ <li class="attribute-virtual-value-field" ng-if="results.length == 0">
+ <strong>No derived attributes selected...</strong>
+ </li>
+</ul>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
new file mode 100644
index 0000000..074abbd
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicPlainAttributes.html
@@ -0,0 +1,22 @@
+<div id="attribute" class="form-group" ng-repeat="plainSchema in dynamicForm.plainSchemas">
+ <label for="plainSchema.key">{{plainSchema.key}} <span ng-if="Boolean(plainSchema.mandatoryCondition)">*</span></label>
+ <div ng-if="!plainSchema.multivalue">
+ <dynamic-attribute schema="plainSchema" user="user" index="0"></dynamic-attribute>
+ </div>
+
+ <div ng-if="plainSchema.multivalue">
+ <div ng-repeat="field in dynamicForm.attributeTable[plainSchema.key].fields track by $index" ng-model='dynamicForm.attributeTable[plainSchema.key].fields[$index]'>
+ <dynamic-attribute schema="plainSchema" user="user" index="$index"></dynamic-attribute>
+ <span>
+ <button class="btn btn-default btn-sm minus" ng-if="$index > 0" type="button" ng-click="removeAttributeField(plainSchema.key, $index)">
+ <i class="glyphicon glyphicon-minus" title="Remove value"></i>
+ </button>
+ </span>
+ </div>
+ <span>
+ <button class="btn btn-default btn-sm" type="button" ng-click="addAttributeField(plainSchema.key)">
+ <i class="glyphicon glyphicon-plus" title="Add value"></i>
+ </button>
+ </span>
+ </div>
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html
new file mode 100644
index 0000000..897eb2c
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/dynamicVirtualAttributes.html
@@ -0,0 +1,18 @@
+<ui-select on-select="addVirtualAttribute($item, $model)" on-remove="removeVirtualAttribute($item, $model)" multiple
+ ng-model="dynamicForm.selectedVirSchemas" theme="select2" ng-disabled="false" class="attribute-ui-select">
+ <ui-select-match placeholder="Select virtual attribute...">{{$item.key}}</ui-select-match>
+ <ui-select-choices repeat="virSchema in dynamicForm.virSchemas | propsFilter: {key: $select.search}">
+ <div ng-bind-html="virSchema.key | highlight: $select.search"></div>
+ </ui-select-choices>
+</ui-select>
+
+<ul class="attribute-virtual-value-container">
+ <li class="attribute-virtual-value-field" ng-repeat="selectedVirSchema in dynamicForm.selectedVirSchemas| filter:q as results">
+ {{selectedVirSchema.key}}
+ <input style="font-weight: normal" class="form-control" type="text" ng-disabled="selectedVirSchema.readonly"
+ ng-model="user.virAttrs[selectedVirSchema.key].values[0]"/>
+ </li>
+ <li class="attribute-virtual-value-field" ng-if="results.length == 0">
+ <strong>No virtual attributes selected...</strong>
+ </li>
+</ul>
\ No newline at end of file
[47/50] [abbrv] syncope git commit: provides wizard to create users,
groups and any objects + several changes merged from master
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.html
deleted file mode 100644
index bbcd878..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:extend>
- <div style="margin: 5px;">
- <p class="ui-widget ui-corner-all ui-widget-header">
- <wicket:message key="title"/> <span wicket:id="displayName"/>
- </p>
- <form wicket:id="groupForm">
- <div id="tabs">
- <div style="display: block; clear: both">
- <ul>
- <li><a href="#details"><span><wicket:message key="details"/></span></a></li>
- <li><a href="#templates"><span><wicket:message key="templates"/></span></a></li>
- <li><a href="#plainAttrs"><span><wicket:message key="plainAttrs"/></span></a></li>
- <li><a href="#derAttrs"><span><wicket:message key="derAttrs"/></span></a></li>
- <li><a href="#virAttrs"><span><wicket:message key="virAttrs"/></span></a></li>
- <li><a href="#resources"><span><wicket:message key="resources"/></span></a></li>
- <li><a href="#entitlements"><span><wicket:message key="entitlements"/></span></a></li>
- <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
- </ul>
- </div>
- <div wicket:id="groupPanel"></div>
- </div>
- <div style="bottom:0;margin:10px">
- <input type="submit"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="submit"/>
- <input type="button"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="cancel"/>
- </div>
- </form>
- </div>
- </wicket:extend>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.properties
deleted file mode 100644
index 4ffa2fb..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel.properties
+++ /dev/null
@@ -1,48 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-required_alert=All form fields are required.
-title=Group
-details=Details
-plainAttrs=Plain attributes
-tab3=Derived attributes
-tab4=Virtual attributes
-resources=Resources
-entitlements=Entitlements
-security=Security
-add=+
-drop=-
-error=Generic error occurred during the operation
-firstResourcesList=Group's resources
-secondResourcesList=Available resources
-firstEntitlementsList=Group's entitlements
-secondEntitlementsList=Available entitlements
-derAttrs=Derived Attributes
-derAttrToRemove=Delete
-derAttrName=Name
-derAttrValue=Derived value
-
-virAttrs=Virtual Attributes
-virAttrToRemove=Delete
-virAttrName=Name
-virAttrValue=Virtual value
-
-addAttributeBtn=Add
-
-inheritPlainAttrs=Inherit plain attributes
-inheritDerAttrs=Inherit derived attributes
-inheritVirAttrs=Inherit virtual attributes
-templates=Templates
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_it.properties
deleted file mode 100644
index 1c6efec..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_it.properties
+++ /dev/null
@@ -1,50 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-required_alert=All form fields are required.
-title=Gruppo
-details=Dettagli
-plainAttrs=Attributi normali
-tab3=Attributi derivati
-tab4=Attributi virtuali
-resources=Risorse
-entitlements=Entitlement
-security=Sicurezza
-add=+
-drop=-
-error=Errore generico durante l'operazione
-firstResourcesList=Risorse ruolo
-secondResourcesList=Risorse disponibili
-firstResourcesList=Risorse gruppo
-secondResourcesList=Risorse disponibili
-derAttrs=Attributi derivati
-derAttrToRemove=Elimina
-derAttrName=Nome
-derAttrValue=Valore derivato
-
-virAttrs=Attributi virtuali
-virAttrToRemove=Elimina
-virAttrName=Nome
-virAttrValue=Valore virtuale
-
-addAttributeBtn=Aggiungi
-
-inheritPlainAttrs=Eredita attributi normali
-inheritDerAttrs=Eredita attributi derivati
-inheritVirAttrs=Eredita attributi virtuali
-templates=Modelo
-secondEntitlementsList=Entitlement disponibili
-firstEntitlementsList=Entitlement gruppo
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_pt_BR.properties
deleted file mode 100644
index 0649585..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/GroupModalPanel_pt_BR.properties
+++ /dev/null
@@ -1,48 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-required_alert=Todos os campos s\u00e3o obrigat\u00f3rios
-title=Grupo
-details=Detalhes
-plainAttrs=Atributos Normal
-tab3=Atributos Derivados
-tab4=Atributos Virtuais
-resources=Recursos
-entitlements=Direitos
-security=Seguran\u00e7a
-add=+
-drop=-
-error=Um erro gen\u00e9rico ocorreu durante a opera\u00e7\u00e3o
-firstResourcesList=Recursos de grupos
-secondResourcesList=Recursos dispon\u00edveis
-firstEntitlementsList=Direitos de grupos
-secondEntitlementsList=Direitos dispon\u00edveis
-derAttrs=Atributos derivados
-derAttrToRemove=Exluir
-derAttrName=Nome
-derAttrValue=Valor Derivado
-
-virAttrs=Atributos Virtuais
-virAttrToRemove=Excluir
-virAttrName=Nome
-virAttrValue=Valor Virtual
-
-addAttributeBtn=Adicionar
-
-inheritPlainAttrs=Atributos Herdados Normal
-inheritDerAttrs=Atributos Derivados Herdados
-inheritVirAttrs=Atributos Virtuais Herdados
-templates=Modelli
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ListViewPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ListViewPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ListViewPanel.html
index 8cad9d0..4f24eb4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ListViewPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ListViewPanel.html
@@ -17,16 +17,11 @@ specific language governing permissions and limitations
under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:panel>
- <span wicket:id="container">
- <wicket:container wicket:id="content" />
- </span>
-
- <wicket:fragment wicket:id="wizard">
- <span wicket:id="wizard"/>
- </wicket:fragment>
-
- <wicket:fragment wicket:id="table">
+ <head>
+ <title>List view panel</title>
+ </head>
+ <body>
+ <wicket:extend>
<div class="col-xs-12">
<div class="box">
<div class="box-header">
@@ -53,9 +48,6 @@ under the License.
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
- <div class="modal-footer" style="text-align: right">
- <input type="submit" class="btn btn-primary" value="Add" wicket:message="value:listview.add" wicket:id="add"/>
- </div>
- </wicket:fragment>
- </wicket:panel>
+ </wicket:extend>
+ </body>
</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html
index 67bbd73..19bcd44 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html
@@ -40,10 +40,6 @@ under the License.
</div>
<div class="form-group">
- <span wicket:id="propagationPrimary">[propagationPrimary]</span>
- </div>
-
- <div class="form-group">
<span wicket:id="propagationPriority">[propagationPriority]</span>
</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
index bad0582..351d029 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal.properties
@@ -51,7 +51,6 @@ updateTraceLevel=Update trace level
deleteTraceLevel=Delete trace level
syncTraceLevel=Synchronization trace level
propagationPriority=Propagation priority
-propagationPrimary=Propagation primary
success_connection=Successful connection
error_connection=Connection failure
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.html
deleted file mode 100644
index 8cb22f0..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:extend>
- <form wicket:id="form">
- <div class="tabbable tabs-left">
- <ul class="nav nav-tabs">
- <li class="active"><a data-toggle="tab" href="#resource"><span><wicket:message key="resource"/></span></a></li>
- <li><a data-toggle="tab" href="#umapping"><span><wicket:message key="umapping"/></span></a></li>
- <li><a data-toggle="tab" href="#gmapping"><span><wicket:message key="gmapping"/></span></a></li>
- <li><a data-toggle="tab" href="#connectorProperties"><span><wicket:message key="connectorProperties"/></span></a></li>
- <li><a data-toggle="tab" href="#security"><span><wicket:message key="security"/></span></a></li>
- </ul>
- <div class="tab-content">
- <div id="resource" class="tab-pane active">
- <span wicket:id="details">[details]</span>
- <span wicket:id="systeminformation">[System Information]</span>
- </div>
- <div id="umapping" class="tab-pane">
- <span wicket:id="umapping">[umapping]</span>
- </div>
- <div id="gmapping" class="tab-pane">
- <span wicket:id="gmapping">[gmapping]</span>
- </div>
- <div id="connectorProperties" class="tab-pane">
- <span wicket:id="connconf">[connconf]</span>
- </div>
- <div id="security" class="tab-pane">
- <span wicket:id="security">[security]</span>
- </div>
- </div>
- </div>
-
- <div class="modal-footer">
- <input type="submit" class="btn btn-primary" wicket:id="apply"/>
- <input type="button" class="btn btn-default" wicket:id="cancel"/>
- </div>
- </form>
- </wicket:extend>
-</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.properties
deleted file mode 100644
index 789919b..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModalPage.properties
+++ /dev/null
@@ -1,60 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-resource=Resource details
-umapping=User mapping
-connectorProperties=Connector properties
-security=Security
-required_alert=All form fields are required
-connector=Connector
-existing_resources=Existing resources
-action=Action
-edit_attribute=Edit resource
-title=Resource
-extAttrNames=External attributes
-intMappingTypes=Internal mapping types
-entity=Entity
-groupSchema=Group Schema
-connObjectKey=ConnObjectKey
-mandatoryCondition=Mandatory
-password=Password
-purpose=Purpose
-mappingUserSchema=Mapping User Schema
-mappingGroupSchema=Mapping Group Schema
-delete=Delete
-intAttrNames=Internal attributes
-enforceMandatoryCondition=Enforce mandatory condition
-fieldName=Field name
-
-connObjectKeyValidation=There must be exactly one ConnObjectKey
-propagationMode=Propagation mode
-connObjectLink=ConnObjectLink
-enable=Enable
-
-createTraceLevel=Create trace level
-updateTraceLevel=Update trace level
-deleteTraceLevel=Delete trace level
-syncTraceLevel=Synchronization trace level
-propagationPriority=Propagation priority
-propagationPrimary=Propagation primary
-
-success_connection=Successful connection
-error_connection=Connection failure
-check=Check connection
-actionsClasses=Actions classes
-gmapping=Group mapping
-new=New resource
-randomPwdIfNotProvided=Generate random passwords when missing
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
index 02c2b81..51cf18e 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_it.properties
@@ -50,7 +50,6 @@ updateTraceLevel=Livello di tracciamento degli aggiornamenti
deleteTraceLevel=Livello di tracciamento delle cancellazioni
syncTraceLevel=Livello di tracciamento delle sincronizzazioni
propagationPriority=Priorit\u00e0 in propagazione
-propagationPrimary=Primaria in propagazione
success_connection=Connessione avvenuta con successo
error_connection=Connessione non riuscita
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
index 9d6faa5..07e0f14 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceModal_pt_BR.properties
@@ -50,7 +50,6 @@ updateTraceLevel=Atualizar n\u00edvel de trace
deleteTraceLevel=Excluir n\u00edvel de trace
syncTraceLevel=N\u00edvel de trace de sincroniza\u00e7\u00e3o
propagationPriority=Prioridade de propaga\u00e7\u00e3o
-propagationPrimary=Propaga\u00e7\u00e3o prim\u00e1ria
success_connection=Conex\u00e3o com sucesso
error_connection=Conex\u00e3o sem sucesso
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.properties
new file mode 100644
index 0000000..c0b84a1
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard.properties
@@ -0,0 +1,18 @@
+# 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.
+wizard.cancel.error = Wizard error on cancel
+wizard.apply.error = Wizard error on apply changes
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_it.properties
new file mode 100644
index 0000000..af40f31
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_it.properties
@@ -0,0 +1,18 @@
+# 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.
+wizard.cancel.error = Errore wizard in annullamento operazione
+wizard.apply.error = Errore wizard in fase di commit
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_pt_BR.properties
new file mode 100644
index 0000000..a73e270
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/AjaxWizard_pt_BR.properties
@@ -0,0 +1,18 @@
+# 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.
+wizard.cancel.error = Erro em assistente de cancelar
+wizard.apply.error = Assistente de erro em aplicar as altera\u00e7\u00f5es
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html
new file mode 100644
index 0000000..e849f37
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/WizardMgtPanel.html
@@ -0,0 +1,45 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <wicket:panel>
+ <span wicket:id="container">
+ <wicket:container wicket:id="content" />
+ </span>
+
+ <wicket:fragment wicket:id="wizard">
+ <span wicket:id="wizard"/>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="default">
+
+ <wicket:child />
+
+ <div class="modal-footer" style="text-align: right">
+ <a haref="#" class="btn btn-primary" wicket:id="add">Add</a>
+ </div>
+ </wicket:fragment>
+
+ <div wicket:id="modal" />
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.html
new file mode 100644
index 0000000..6b17a06
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.html
@@ -0,0 +1,42 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org" xmlns:message="http://xmlns.jcp.org/jsf/composite">
+ <head><title></title></head>
+ <body>
+ <wicket:panel>
+ <span wicket:id="content">[CONTENT]</span>
+
+ <wicket:fragment wicket:id="empty">
+ <div class="attribute.empty.list">
+ <wicket:message key="attribute.empty.list"/>
+ </div>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="attributes">
+ <div wicket:id="derAttrContainer">
+ <div class="form-group" wicket:id="attrs">
+ <span wicket:id="panel">
+ [panel for dynamic input type markup]
+ </span>
+ </div>
+ </div>
+ </wicket:fragment>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.properties
new file mode 100644
index 0000000..72b580f
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs.properties
@@ -0,0 +1,18 @@
+# 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.
+derived.emptyvalue.message=Value to be derived ...
+attribute.empty.list=No derived attributes available
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_it.properties
new file mode 100644
index 0000000..d275c71
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_it.properties
@@ -0,0 +1,18 @@
+# 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.
+derived.emptyvalue.message=Valore da derivare ...
+attribute.empty.list=Non ci sono attributi derivati disponibili
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_pt_BR.properties
new file mode 100644
index 0000000..b659c46
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/DerAttrs_pt_BR.properties
@@ -0,0 +1,18 @@
+# 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.
+derived.emptyvalue.message=Valor a ser derivada ...
+attribute.empty.list=Sem atributos derivados dispon\u00edveis
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.html
new file mode 100644
index 0000000..c813528
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.html
@@ -0,0 +1,56 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <head><title></title></head>
+ <body>
+ <wicket:panel>
+ <div class="form-group">
+ <span wicket:id="name"/>
+ <a class="tooltips" wicket:id="questionMarkJexlHelp" href="#" alt="Click to help" title="Click to help">
+ <img src="img/help.png"/>
+ <span wicket:id="jexlHelp" class="tooltips">
+ <wicket:message key="jexl_info"/>
+ <ul>
+ <li><wicket:message key="jexl_ex1"/></li>
+ <li><wicket:message key="jexl_ex2"/></li>
+ </ul>
+ <a href="#" wicket:id="jexlLink" target="_blank"><wicket:message key="jexl_syntax_url"/></a>
+ </span>
+ </a>
+ </div>
+
+ <div wicket:id="ownerContainer">
+ <div class="form-group">
+ <span wicket:id="userOwner"/>
+ <a href="#" wicket:id="userOwnerSelect"><img src="img/actions/search.png" alt="select user owner" title="Search"/></a>
+ <a href="#" wicket:id="userOwnerReset"><img src="img/actions/delete.png" alt="reset user owner" title="Delete"/></a>
+ </div>
+
+ <div class="form-group">
+ <span wicket:id="groupOwner"/>
+ <a href="#" wicket:id="groupOwnerSelect"><img src="img/actions/search.png" alt="select group owner" title="Search"/></a>
+ <a href="#" wicket:id="groupOwnerReset"><img src="img/actions/delete.png" alt="reset group owner" title="Delete"/></a>
+ </div>
+ </div>
+
+ <span wicket:id="userOwnerSelectWin"/>
+ <span wicket:id="groupOwnerSelectWin"/>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.properties
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails.properties
@@ -0,0 +1,16 @@
+# 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.
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_it.properties
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_it.properties
@@ -0,0 +1,16 @@
+# 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.
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_pt_BR.properties
new file mode 100644
index 0000000..13a8339
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/GroupDetails_pt_BR.properties
@@ -0,0 +1,16 @@
+# 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.
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/PlainAttrs.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/PlainAttrs.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/PlainAttrs.html
new file mode 100644
index 0000000..52f6321
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/PlainAttrs.html
@@ -0,0 +1,40 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <wicket:panel>
+ <div wicket:id="schemas">
+ <div class="form-group">
+ <span wicket:id="panel">
+ [panel for dynamic input type markup]
+ </span>
+ <a class="tooltips" wicket:id="questionMarkJexlHelp" href="#" alt="Click to help" title="Click to help">
+ <img src="img/help.png"/>
+ <span wicket:id="jexlHelp" class="tooltips">
+ <wicket:message key="jexl_info"/>
+ <ul>
+ <li><wicket:message key="jexl_ex1"/></li>
+ <li><wicket:message key="jexl_ex2"/></li>
+ </ul>
+ <a href="#" wicket:id="jexlLink" target="_blank"><wicket:message key="jexl_syntax_url"/></a>
+ </span>
+ </a>
+ </div>
+ </div>
+ </wicket:panel>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.html
new file mode 100644
index 0000000..45e550c
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.html
@@ -0,0 +1,59 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <head><title></title></head>
+ <body>
+ <wicket:panel>
+ <div class="form-group">
+ <span wicket:id="username"/>
+ <a class="tooltips" wicket:id="usernameQuestionMarkJexlHelp" href="#" alt="Click to help" title="Click to help">
+ <img src="img/help.png"/>
+ <span wicket:id="usernameJexlHelp" class="tooltips">
+ <wicket:message key="jexl_info"/>
+ <ul>
+ <li><wicket:message key="jexl_ex1"/></li>
+ <li><wicket:message key="jexl_ex2"/></li>
+ </ul>
+ <a href="#" wicket:id="jexlLink" target="_blank"><wicket:message key="jexl_syntax_url"/></a>
+ </span>
+ </a>
+ </div>
+
+ <form wicket:id="passwordInnerForm">
+ <div class="form-group">
+ <span wicket:id="password"/>
+ <a class="tooltips" wicket:id="pwdQuestionMarkJexlHelp" href="#" alt="Click to help" title="Click to help">
+ <img src="img/help.png"/>
+ <span wicket:id="pwdJexlHelp" class="tooltips">
+ <wicket:message key="jexl_info"/>
+ <ul>
+ <li><wicket:message key="jexl_ex1"/></li>
+ <li><wicket:message key="jexl_ex2"/></li>
+ </ul>
+ <a href="#" wicket:id="jexlLink" target="_blank"><wicket:message key="jexl_syntax_url"/></a>
+ </span>
+ </a>
+ </div>
+ <div class="form-group">
+ <span wicket:id="confirmPassword"/>
+ </div>
+ </form>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.properties
new file mode 100644
index 0000000..f07fe03
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails.properties
@@ -0,0 +1,19 @@
+# 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.
+username=Username
+password=Password
+confirmPassword=Password (confirm)
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_it.properties
new file mode 100644
index 0000000..741d7dd
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_it.properties
@@ -0,0 +1,19 @@
+# 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.
+username=Username
+password=Password
+confirmPassword=Password (conferma)
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_pt_BR.properties
new file mode 100644
index 0000000..9debd26
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/UserDetails_pt_BR.properties
@@ -0,0 +1,19 @@
+# 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.
+username=Nome do Usu\u00E1rio
+password=Senha
+confirmPassword=Senha (confirmar)
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.html
new file mode 100644
index 0000000..c73710d
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.html
@@ -0,0 +1,42 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org" xmlns:message="http://xmlns.jcp.org/jsf/composite">
+ <head><title></title></head>
+ <body>
+ <wicket:panel>
+ <span wicket:id="content">[CONTENT]</span>
+
+ <wicket:fragment wicket:id="empty">
+ <div class="attribute.empty.list">
+ <wicket:message key="attribute.empty.list"/>
+ </div>
+ </wicket:fragment>
+
+ <wicket:fragment wicket:id="attributes">
+ <div wicket:id="virAttrContainer">
+ <div class="form-group" wicket:id="attrs">
+ <span wicket:id="panel">
+ [panel for dynamic input type markup]
+ </span>
+ </div>
+ </div>
+ </wicket:fragment>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.properties
new file mode 100644
index 0000000..0750893
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs.properties
@@ -0,0 +1,17 @@
+# 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.
+attribute.empty.list=No virtual attributes available
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_it.properties
new file mode 100644
index 0000000..8c52b7b
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_it.properties
@@ -0,0 +1,17 @@
+# 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.
+attribute.empty.list=Non ci sono attributi virtuali disponibili
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_pt_BR.properties
new file mode 100644
index 0000000..5ee69a0
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/VirAttrs_pt_BR.properties
@@ -0,0 +1,17 @@
+# 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.
+attribute.empty.list=Sem atributos virtuais dispon\u00edveis
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ConnObjectLink.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ConnObjectLink.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ConnObjectLink.html
index cb4d27f..2f889e6 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ConnObjectLink.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ConnObjectLink.html
@@ -16,16 +16,18 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://xmlns.jcp.org/jsf/composite">
- <wicket:panel>
- <span wicket:id="connObjectLinkContainer">
- <div class="form-group">
- <span wicket:id="connObjectLinkCheckbox">[connObjectLinkCheckbox]</span>
- </div>
- <div class="form-group">
- <span wicket:id="connObjectLink">[connObjectLink]</span>
- </div>
- </span>
- </wicket:panel>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://xmlns.jcp.org/jsf/composite">
+ <head><title></title></head>
+ <body>
+ <wicket:panel>
+ <span wicket:id="connObjectLinkContainer">
+ <div class="form-group">
+ <span wicket:id="connObjectLinkCheckbox">[connObjectLinkCheckbox]</span>
+ </div>
+ <div class="form-group">
+ <span wicket:id="connObjectLink">[connObjectLink]</span>
+ </div>
+ </span>
+ </wicket:panel>
+ </body>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$Mapping.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$Mapping.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$Mapping.html
index 2147713..f5eaaeb 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$Mapping.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$Mapping.html
@@ -16,8 +16,11 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-<html xmlns="http://www.w3.org/1999/xhtml">
- <wicket:panel>
- <span wicket:id="mapping" />
- </wicket:panel>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://xmlns.jcp.org/jsf/composite">
+ <head><title></title></head>
+ <body>
+ <wicket:panel>
+ <span wicket:id="mapping" />
+ </wicket:panel>
+ </body>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ObjectType.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ObjectType.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ObjectType.html
index 8d998de..95b13a9 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ObjectType.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder$ObjectType.html
@@ -16,16 +16,18 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:wicket="http://xmlns.jcp.org/jsf/composite">
- <wicket:panel >
- <div class="form-group">
- <label>Object Type</label>
- <span wicket:id="type"/>
- </div>
- <div class="form-group">
- <label>Object Class</label>
- <input type="text" placeholder="Object Class ..." class="form-control" wicket:id="class">
- </div>
- </wicket:panel>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://xmlns.jcp.org/jsf/composite">
+ <head><title></title></head>
+ <body>
+ <wicket:panel >
+ <div class="form-group">
+ <label>Object Type</label>
+ <span wicket:id="type"/>
+ </div>
+ <div class="form-group">
+ <label>Object Class</label>
+ <input type="text" placeholder="Object Class ..." class="form-control" wicket:id="class">
+ </div>
+ </wicket:panel>
+ </body>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/enduser/pom.xml
----------------------------------------------------------------------
diff --git a/client/enduser/pom.xml b/client/enduser/pom.xml
index a9dc260..372ac7a 100644
--- a/client/enduser/pom.xml
+++ b/client/enduser/pom.xml
@@ -66,10 +66,6 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
- <artifactId>wicket-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.wicket</groupId>
<artifactId>wicket-auth-roles</artifactId>
</dependency>
@@ -191,4 +187,4 @@ under the License.
</build>
-</project>
\ No newline at end of file
+</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
index 7c1a43a..e6ec502 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
@@ -28,6 +28,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
@@ -54,15 +55,17 @@ public interface SchemaService extends JAXRSService {
@NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String key);
/**
- * Returns a list of schemas with matching type.
+ * Returns a list of schemas with matching type, for the given anyTypeClass if provided.
*
* @param <T> actual SchemaTO
* @param type type for schemas to be listed
- * @return list of schemas with matching type
+ * @param anyTypeClass any type class name
+ * @return list of schemas with matching type, for the given anyTypeClass if provided
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- <T extends AbstractSchemaTO> List<T> list(@NotNull @PathParam("type") SchemaType type);
+ <T extends AbstractSchemaTO> List<T> list(@NotNull @PathParam("type") SchemaType type,
+ @QueryParam("anyType") String anyTypeClass);
/**
* Creates a new schema.
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
index cbd5f64..f3b1b09 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
@@ -33,11 +33,13 @@ import org.apache.syncope.common.lib.to.VirSchemaTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.DuplicateException;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
+import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
import org.apache.syncope.core.persistence.api.entity.DerSchema;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
@@ -59,6 +61,9 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
private VirSchemaDAO virSchemaDAO;
@Autowired
+ private AnyTypeClassDAO anyTypeClassDAO;
+
+ @Autowired
private SchemaDataBinder binder;
private boolean doesSchemaExist(final SchemaType schemaType, final String name) {
@@ -140,11 +145,13 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
@PreAuthorize("isAuthenticated()")
@SuppressWarnings("unchecked")
- public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType) {
+ public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType, final String anyTypeClass) {
+ AnyTypeClass clazz = anyTypeClass == null ? null : anyTypeClassDAO.find(anyTypeClass);
List<T> result;
switch (schemaType) {
case VIRTUAL:
- result = CollectionUtils.collect(virSchemaDAO.findAll(),
+ result = CollectionUtils.collect(
+ clazz == null ? virSchemaDAO.findAll() : virSchemaDAO.findByAnyTypeClass(clazz),
new Transformer<VirSchema, T>() {
@Override
@@ -155,7 +162,8 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
break;
case DERIVED:
- result = CollectionUtils.collect(derSchemaDAO.findAll(),
+ result = CollectionUtils.collect(
+ clazz == null ? derSchemaDAO.findAll() : derSchemaDAO.findByAnyTypeClass(clazz),
new Transformer<DerSchema, T>() {
@Override
@@ -167,7 +175,8 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
case PLAIN:
default:
- result = CollectionUtils.collect(plainSchemaDAO.findAll(),
+ result = CollectionUtils.collect(
+ clazz == null ? plainSchemaDAO.findAll() : plainSchemaDAO.findByAnyTypeClass(clazz),
new Transformer<PlainSchema, T>() {
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/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 126c1e1..d39c9e9 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
@@ -99,8 +99,8 @@ public class ConnectorFacadeProxy implements Connector {
public ConnectorFacadeProxy(final ConnInstance connInstance) {
this.connInstance = connInstance;
- ConnIdBundleManager connIdBundleManager =
- ApplicationContextProvider.getBeanFactory().getBean(ConnIdBundleManager.class);
+ ConnIdBundleManager connIdBundleManager = ApplicationContextProvider.getBeanFactory().getBean(
+ ConnIdBundleManager.class);
ConnectorInfo info = connIdBundleManager.getConnectorInfo(connInstance);
// create default configuration
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
index b8e1522..c5fad73 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/SyncJobDelegate.java
@@ -128,20 +128,17 @@ public class SyncJobDelegate extends AbstractProvisioningJobDelegate<SyncTask> {
profile.setResAct(getSyncPolicySpec(syncTask).getConflictResolutionAction());
// Prepare handler for SyncDelta objects (any objects)
- AnyObjectSyncResultHandler ahandler =
- (AnyObjectSyncResultHandler) ApplicationContextProvider.getBeanFactory().
+ AnyObjectSyncResultHandler ahandler = (AnyObjectSyncResultHandler) ApplicationContextProvider.getBeanFactory().
createBean(AnyObjectSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
ahandler.setProfile(profile);
// Prepare handler for SyncDelta objects (users)
- UserSyncResultHandler uhandler =
- (UserSyncResultHandler) ApplicationContextProvider.getBeanFactory().
+ UserSyncResultHandler uhandler = (UserSyncResultHandler) ApplicationContextProvider.getBeanFactory().
createBean(UserSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
uhandler.setProfile(profile);
// Prepare handler for SyncDelta objects (groups)
- GroupSyncResultHandler ghandler =
- (GroupSyncResultHandler) ApplicationContextProvider.getBeanFactory().
+ GroupSyncResultHandler ghandler = (GroupSyncResultHandler) ApplicationContextProvider.getBeanFactory().
createBean(GroupSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
ghandler.setProfile(profile);
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
index d5380ab..07d84fb 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SchemaServiceImpl.java
@@ -51,8 +51,8 @@ public class SchemaServiceImpl extends AbstractServiceImpl implements SchemaServ
}
@Override
- public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType) {
- return logic.list(schemaType);
+ public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType, final String anyTypeClass) {
+ return logic.list(schemaType, anyTypeClass);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
index 210b515..ac941b7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DerSchemaITCase.java
@@ -40,7 +40,7 @@ public class DerSchemaITCase extends AbstractITCase {
@Test
public void list() {
- List<DerSchemaTO> derivedSchemas = schemaService.list(SchemaType.DERIVED);
+ List<DerSchemaTO> derivedSchemas = schemaService.list(SchemaType.DERIVED, null);
assertFalse(derivedSchemas.isEmpty());
for (DerSchemaTO derivedSchemaTO : derivedSchemas) {
assertNotNull(derivedSchemaTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
index 3ddb2c8..d247aac 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@ -674,7 +674,7 @@ public class GroupITCase extends AbstractITCase {
assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
group = result.getAny();
-
+
// 3. set capability override with only search allowed, but not enable
ldap.getCapabilitiesOverride().add(ConnectorCapability.SEARCH);
resourceService.update(ldap);
@@ -867,5 +867,5 @@ public class GroupITCase extends AbstractITCase {
assertNotNull(groupTO);
assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
}
-
+
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
index 64f0008..2a9dffe 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
@@ -100,7 +100,7 @@ public class MultitenancyITCase extends AbstractITCase {
@Test
public void readPlainSchemas() {
- assertEquals(17, adminClient.getService(SchemaService.class).list(SchemaType.PLAIN).size());
+ assertEquals(17, adminClient.getService(SchemaService.class).list(SchemaType.PLAIN, null).size());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
index d275712..2a75805 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
@@ -29,6 +29,8 @@ import java.security.AccessControlException;
import java.util.List;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
@@ -36,6 +38,7 @@ import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -83,7 +86,6 @@ public class PlainSchemaITCase extends AbstractITCase {
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
-
assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidName.name()));
}
}
@@ -99,9 +101,7 @@ public class PlainSchemaITCase extends AbstractITCase {
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
-
- assertTrue(e.getElements().iterator().next().toString().
- contains(EntityViolationType.InvalidSchemaEnum.name()));
+ assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidSchemaEnum.name()));
}
}
@@ -116,7 +116,6 @@ public class PlainSchemaITCase extends AbstractITCase {
fail("This should not be reacheable");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.InvalidPlainSchema, e.getType());
-
assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidSchemaEnum.name()));
}
}
@@ -160,23 +159,38 @@ public class PlainSchemaITCase extends AbstractITCase {
@Test
public void list() {
- List<PlainSchemaTO> userSchemas = schemaService.list(SchemaType.PLAIN);
- assertFalse(userSchemas.isEmpty());
- for (PlainSchemaTO schemaTO : userSchemas) {
- assertNotNull(schemaTO);
- }
-
- List<PlainSchemaTO> groupSchemas = schemaService.list(SchemaType.PLAIN);
- assertFalse(groupSchemas.isEmpty());
- for (PlainSchemaTO schemaTO : groupSchemas) {
+ List<PlainSchemaTO> schemas = schemaService.list(SchemaType.PLAIN, null);
+ assertFalse(schemas.isEmpty());
+ for (PlainSchemaTO schemaTO : schemas) {
assertNotNull(schemaTO);
}
+ }
- List<PlainSchemaTO> membershipSchemas = schemaService.list(SchemaType.PLAIN);
- assertFalse(membershipSchemas.isEmpty());
- for (PlainSchemaTO schemaTO : membershipSchemas) {
- assertNotNull(schemaTO);
- }
+ @Test
+ public void listByAnyTypeClass() {
+ final String clazz = anyTypeService.read(AnyTypeKind.USER.name()).getClasses().get(0);
+
+ List<PlainSchemaTO> userSchemas = schemaService.list(SchemaType.PLAIN, clazz);
+
+ assertTrue(CollectionUtils.exists(userSchemas, new Predicate<PlainSchemaTO>() {
+
+ @Override
+ public boolean evaluate(final PlainSchemaTO object) {
+ return "fullname".equals(object.getKey());
+ }
+ }));
+
+ assertFalse(CollectionUtils.exists(userSchemas, new Predicate<PlainSchemaTO>() {
+
+ @Override
+ public boolean evaluate(final PlainSchemaTO object) {
+ return "password.cipher.algorithm".equals(object.getKey())
+ || "rderived_dx".equals(object.getKey())
+ || "icon".equals(object.getKey())
+ || "mderived_sx".equals(object.getKey())
+ || "self.membership.layout".equals(object.getKey());
+ }
+ }));
}
@Test
@@ -323,13 +337,13 @@ public class PlainSchemaITCase extends AbstractITCase {
public void anonymous() {
SchemaService unauthenticated = clientFactory.create().getService(SchemaService.class);
try {
- unauthenticated.list(SchemaType.VIRTUAL);
+ unauthenticated.list(SchemaType.VIRTUAL, null);
fail();
} catch (AccessControlException e) {
assertNotNull(e);
}
SchemaService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(SchemaService.class);
- assertFalse(anonymous.list(SchemaType.VIRTUAL).isEmpty());
+ assertFalse(anonymous.list(SchemaType.VIRTUAL, null).isEmpty());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
index c4e4ea0..45b4762 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirSchemaITCase.java
@@ -41,7 +41,7 @@ public class VirSchemaITCase extends AbstractITCase {
@Test
public void list() {
- List<VirSchemaTO> vSchemas = schemaService.list(SchemaType.VIRTUAL);
+ List<VirSchemaTO> vSchemas = schemaService.list(SchemaType.VIRTUAL, null);
assertFalse(vSchemas.isEmpty());
for (VirSchemaTO vSchemaTO : vSchemas) {
assertNotNull(vSchemaTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 893ada1..effa158 100644
--- a/pom.xml
+++ b/pom.xml
@@ -376,6 +376,7 @@ under the License.
<jquery-ui.version>1.11.4</jquery-ui.version>
<jquery-cookie.version>1.4.1-1</jquery-cookie.version>
<bootstrap.version>3.3.5</bootstrap.version>
+ <bootstrap-select.version>1.7.3</bootstrap-select.version>
<wicket-bootstrap.version>0.10.4-SNAPSHOT</wicket-bootstrap.version>
<bootbox.version>4.4.0</bootbox.version>
@@ -968,6 +969,11 @@ under the License.
</dependency>
<dependency>
<groupId>org.webjars</groupId>
+ <artifactId>bootstrap-select</artifactId>
+ <version>${bootstrap-select.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>${font-awesome.version}</version>
</dependency>
[34/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
[SYNCOPE-141][SYNCOPE-142] Implementation completed
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1b81e33c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1b81e33c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1b81e33c
Branch: refs/heads/SYNCOPE-156
Commit: 1b81e33c74e883c38349630098316a7fb1ade866
Parents: 6d368c8
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Oct 29 17:31:58 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Oct 29 17:32:32 2015 +0100
----------------------------------------------------------------------
.../cli/commands/task/TaskResultManager.java | 2 +-
.../cli/commands/user/UserResultManager.java | 2 -
.../syncope/client/console/pages/Realms.java | 2 -
.../syncope/client/console/panels/Realm.java | 2 -
.../client/console/panels/RealmModalPanel.java | 2 -
.../syncope/client/lib/SyncopeClient.java | 13 +
.../syncope/common/lib/patch/PasswordPatch.java | 2 +-
.../org/apache/syncope/common/lib/to/AnyTO.java | 9 -
.../common/lib/to/PropagationStatus.java | 50 --
.../common/lib/to/PropagationTaskTO.java | 10 +-
.../common/lib/to/ProvisioningResult.java | 55 +++
.../syncope/common/lib/to/ResourceTO.java | 16 +-
.../syncope/common/rest/api/RESTHeaders.java | 5 +
.../common/rest/api/service/AnyService.java | 8 +-
.../rest/api/service/UserSelfService.java | 10 +-
.../common/rest/api/service/UserService.java | 4 +-
.../syncope/core/logic/AbstractAnyLogic.java | 40 +-
.../core/logic/AbstractResourceAssociator.java | 19 +-
.../syncope/core/logic/AnyObjectLogic.java | 69 +--
.../apache/syncope/core/logic/GroupLogic.java | 66 +--
.../apache/syncope/core/logic/UserLogic.java | 137 +++---
.../api/entity/resource/ExternalResource.java | 4 -
.../api/entity/task/PropagationTask.java | 2 +
.../entity/resource/JPAExternalResource.java | 21 -
.../jpa/entity/task/JPAPropagationTask.java | 17 +-
.../persistence/jpa/inner/ResourceTest.java | 3 -
.../test/resources/domains/MasterContent.xml | 64 +--
.../api/AnyObjectProvisioningManager.java | 2 +-
.../api/GroupProvisioningManager.java | 4 +-
.../provisioning/api/ProvisioningManager.java | 14 +-
.../api/UserProvisioningManager.java | 30 +-
.../api/propagation/PropagationReporter.java | 30 +-
.../propagation/PropagationTaskCallable.java | 32 ++
.../propagation/PropagationTaskExecutor.java | 21 +-
.../api/sync/ProvisioningProfile.java | 4 +-
.../api/sync/ProvisioningReport.java | 140 ++++++
.../api/sync/ProvisioningResult.java | 140 ------
.../core/provisioning/api/sync/PushActions.java | 4 +-
.../core/provisioning/api/sync/SyncActions.java | 4 +-
.../DefaultAnyObjectProvisioningManager.java | 72 ++-
.../java/DefaultGroupProvisioningManager.java | 84 ++--
.../java/DefaultUserProvisioningManager.java | 152 +++---
.../java/data/AbstractAnyDataBinder.java | 5 +-
.../java/data/ResourceDataBinderImpl.java | 4 -
.../java/data/TaskDataBinderImpl.java | 1 +
.../java/job/SchedulerShutdown.java | 4 -
.../java/job/SpringBeanJobFactory.java | 6 +-
.../notification/NotificationManagerImpl.java | 19 +-
.../AbstractPropagationTaskExecutor.java | 39 +-
.../propagation/DefaultPropagationReporter.java | 80 ++--
.../PriorityPropagationTaskExecutor.java | 161 +++++--
.../PropagationTaskCallableImpl.java | 94 ++++
.../sync/AbstractProvisioningJobDelegate.java | 104 ++---
.../java/sync/AbstractPushResultHandler.java | 14 +-
.../java/sync/AbstractSyncResultHandler.java | 94 ++--
.../sync/AnyObjectSyncResultHandlerImpl.java | 11 +-
.../java/sync/DBPasswordSyncActions.java | 4 +-
.../java/sync/DefaultPushActions.java | 6 +-
.../java/sync/DefaultSyncActions.java | 6 +-
.../java/sync/GroupSyncResultHandlerImpl.java | 13 +-
.../java/sync/LDAPMembershipSyncActions.java | 4 +-
.../java/sync/LDAPPasswordSyncActions.java | 4 +-
.../sync/PlainAttrsSyncCorrelationRule.java | 6 +-
.../java/sync/UserSyncResultHandlerImpl.java | 17 +-
.../src/main/resources/provisioning.properties | 4 +
.../src/main/resources/provisioningContext.xml | 12 +-
.../syncope/core/rest/cxf/AddETagFilter.java | 18 +-
.../rest/cxf/service/AbstractAnyService.java | 59 ++-
.../rest/cxf/service/AbstractServiceImpl.java | 30 +-
.../rest/cxf/service/ResourceServiceImpl.java | 4 +-
.../rest/cxf/service/UserSelfServiceImpl.java | 11 +-
.../core/rest/cxf/service/UserServiceImpl.java | 7 +-
.../CamelAnyObjectProvisioningManager.java | 37 +-
.../camel/CamelGroupProvisioningManager.java | 45 +-
.../camel/CamelUserProvisioningManager.java | 106 +++--
.../processor/AnyObjectCreateProcessor.java | 13 +-
.../processor/AnyObjectDeleteProcessor.java | 13 +-
.../AnyObjectDeprovisionProcessor.java | 13 +-
.../processor/AnyObjectProvisionProcessor.java | 13 +-
.../processor/AnyObjectUpdateProcessor.java | 13 +-
.../processor/GroupCreateInSyncProcessor.java | 13 +-
.../camel/processor/GroupCreateProcessor.java | 13 +-
.../camel/processor/GroupDeleteProcessor.java | 13 +-
.../processor/GroupDeprovisionProcessor.java | 13 +-
.../processor/GroupProvisionProcessor.java | 13 +-
.../camel/processor/GroupUpdateProcessor.java | 9 +-
.../processor/UserConfirmPwdResetProcessor.java | 12 +-
.../camel/processor/UserCreateProcessor.java | 9 +-
.../camel/processor/UserDeleteProcessor.java | 13 +-
.../processor/UserDeprovisionProcessor.java | 13 +-
.../camel/processor/UserProvisionProcessor.java | 13 +-
.../processor/UserSetStatusInSyncProcessor.java | 2 +-
.../UserStatusPropagationProcessor.java | 14 +-
.../processor/UserUpdateInSyncProcessor.java | 9 +-
.../camel/processor/UserUpdateProcessor.java | 13 +-
.../src/main/resources/provisioning.properties | 4 +
.../src/main/resources/userRoutes.xml | 2 +-
.../main/resources/all/provisioning.properties | 4 +
.../resources/mariadb/provisioning.properties | 4 +
.../resources/mysql/provisioning.properties | 4 +
.../resources/oracle/provisioning.properties | 4 +
.../resources/postgres/provisioning.properties | 4 +
.../src/main/resources/provisioning.properties | 4 +
.../resources/sqlserver/provisioning.properties | 4 +
.../fit/core/reference/AbstractITCase.java | 96 ++--
.../fit/core/reference/AnyObjectITCase.java | 16 +-
.../core/reference/AuthenticationITCase.java | 29 +-
.../fit/core/reference/CamelRouteITCase.java | 2 +-
.../syncope/fit/core/reference/GroupITCase.java | 102 ++--
.../fit/core/reference/MultitenancyITCase.java | 5 +-
.../core/reference/NotificationTaskITCase.java | 4 +-
.../fit/core/reference/PlainSchemaITCase.java | 11 +-
.../fit/core/reference/PushTaskITCase.java | 4 +-
.../fit/core/reference/ReportITCase.java | 2 +-
.../fit/core/reference/ResourceITCase.java | 6 +-
.../fit/core/reference/SearchITCase.java | 2 +-
.../fit/core/reference/SyncTaskITCase.java | 26 +-
.../syncope/fit/core/reference/UserITCase.java | 466 +++++++++++--------
.../fit/core/reference/UserSelfITCase.java | 26 +-
.../fit/core/reference/UserWorkflowITCase.java | 16 +-
.../fit/core/reference/VirAttrITCase.java | 86 ++--
pom.xml | 6 +-
122 files changed, 1945 insertions(+), 1627 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
index 6075be7..ad8b658 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskResultManager.java
@@ -113,7 +113,7 @@ public class TaskResultManager extends CommonsResultManager {
System.out.println(" latest execution status: "
+ propagationTaskTO.getLatestExecStatus());
System.out.println(" class name: " + propagationTaskTO.getObjectClassName());
- System.out.println(" xml attribute: " + propagationTaskTO.getXmlAttributes());
+ System.out.println(" attributes: " + propagationTaskTO.getAttributes());
System.out.println(" start date: " + propagationTaskTO.getStartDate());
System.out.println(" end date: " + propagationTaskTO.getEndDate());
System.out.println(" operation: " + propagationTaskTO.getOperation());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
index 900d32c..b175842 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
@@ -58,8 +58,6 @@ public class UserResultManager extends CommonsResultManager {
System.out.println(" last change: " + userTO.getLastChangeDate());
System.out.println(" last login: " + userTO.getLastLoginDate());
System.out.println(" failed logins: " + userTO.getFailedLogins());
- System.out.println("PROPAGATIONS:");
- printPropagationStatus(userTO.getPropagationStatusTOs());
System.out.println("RELATIONSHIPS:");
printRelationships(userTO.getRelationships());
System.out.println(" security question id: " + userTO.getSecurityQuestion());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
index 3c5f0ea..4a2101d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.client.console.pages;
-import static org.apache.wicket.Component.ENABLE;
-
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.panels.Realm;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
index 68a0b79..8a28b16 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.client.console.panels;
-import static org.apache.syncope.common.lib.types.AnyTypeKind.USER;
-
import com.googlecode.wicket.jquery.core.panel.LabelPanel;
import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmModalPanel.java
index 7e8f415..7e6aee6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmModalPanel.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.client.console.panels;
-import static org.apache.wicket.Component.ENABLE;
-
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.AbstractBasePage;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index ca9f1c3..905fb4c 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -255,6 +255,19 @@ public class SyncopeClient {
}
/**
+ * Asks for asynchronous propagation towards external resources with null priority.
+ *
+ * @param <T> any service class
+ * @param serviceClass service class reference
+ * @param nullPriorityAsync whether asynchronous propagation towards external resources with null priority is
+ * requested
+ * @return service instance of the given reference class, with related header set
+ */
+ public <T> T nullPriorityAsync(final Class<T> serviceClass, final boolean nullPriorityAsync) {
+ return header(serviceClass, RESTHeaders.NULL_PRIORITY_ASYNC, nullPriorityAsync);
+ }
+
+ /**
* Sets the {@code If-Match} or {@code If-None-Match} header on the given service instance.
*
* @param <T> any service class
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java
index 1149d2d..93e6b9e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java
@@ -55,7 +55,7 @@ public class PasswordPatch extends StringReplacePatchItem {
return this;
}
- public Builder values(final String... resources) {
+ public Builder resources(final String... resources) {
CollectionUtils.addAll(getInstance().getResources(), resources);
return this;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
index 7911d7d..ce4a58f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
@@ -58,8 +58,6 @@ public abstract class AnyTO extends ConnObjectTO {
private final Set<String> resources = new HashSet<>();
- private final List<PropagationStatus> propagationStatusTOs = new ArrayList<>();
-
public long getKey() {
return key;
}
@@ -140,11 +138,4 @@ public abstract class AnyTO extends ConnObjectTO {
return resources;
}
- @XmlElementWrapper(name = "propagationStatuses")
- @XmlElement(name = "propagationStatus")
- @JsonProperty("propagationStatuses")
- public List<PropagationStatus> getPropagationStatusTOs() {
- return propagationStatusTOs;
- }
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationStatus.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationStatus.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationStatus.java
index 38a8da7..c2caa60 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationStatus.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationStatus.java
@@ -57,92 +57,42 @@ public class PropagationStatus extends AbstractBaseBean {
*/
private String failureReason;
- /**
- * After object getter.
- *
- * @return after object.
- */
public ConnObjectTO getAfterObj() {
return afterObj;
}
- /**
- * After object setter.
- *
- * @param afterObj object.
- */
public void setAfterObj(final ConnObjectTO afterObj) {
this.afterObj = afterObj;
}
- /**
- * Before object getter.
- *
- * @return before object.
- */
public ConnObjectTO getBeforeObj() {
return beforeObj;
}
- /**
- * Before object setter.
- *
- * @param beforeObj object.
- */
public void setBeforeObj(final ConnObjectTO beforeObj) {
this.beforeObj = beforeObj;
}
- /**
- * resource name getter.
- *
- * @return resource name.
- */
public String getResource() {
return resource;
}
- /**
- * Resource name setter.
- *
- * @param resource resource name
- */
public void setResource(final String resource) {
this.resource = resource;
}
- /**
- * Propagation execution status getter.
- *
- * @return status
- */
public PropagationTaskExecStatus getStatus() {
return status;
}
- /**
- * Propagation execution status setter.
- *
- * @param status propagation execution status
- */
public void setStatus(final PropagationTaskExecStatus status) {
this.status = status;
}
- /**
- * Propagation execution message getter.
- *
- * @return failureReason.
- */
public String getFailureReason() {
return failureReason;
}
- /**
- * Propagation execution failure message setter.
- *
- * @param failureReason describes why this propagation failed
- */
public void setFailureReason(final String failureReason) {
this.failureReason = failureReason;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
index 1b1d556..d176bb2 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java
@@ -35,7 +35,7 @@ public class PropagationTaskTO extends AbstractTaskTO {
private String oldConnObjectKey;
- private String xmlAttributes;
+ private String attributes;
private String resource;
@@ -77,12 +77,12 @@ public class PropagationTaskTO extends AbstractTaskTO {
this.operation = operation;
}
- public String getXmlAttributes() {
- return xmlAttributes;
+ public String getAttributes() {
+ return attributes;
}
- public void setXmlAttributes(final String xmlAttributes) {
- this.xmlAttributes = xmlAttributes;
+ public void setAttributes(final String attributes) {
+ this.attributes = attributes;
}
public String getObjectClassName() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
new file mode 100644
index 0000000..f2a5bc1
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
@@ -0,0 +1,55 @@
+/*
+ * 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.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+@XmlRootElement(name = "provisioningResult")
+@XmlType
+public class ProvisioningResult<A extends AnyTO> extends AbstractBaseBean {
+
+ private static final long serialVersionUID = 351317476398082746L;
+
+ private A any;
+
+ private final List<PropagationStatus> propagationStatuses = new ArrayList<>();
+
+ public A getAny() {
+ return any;
+ }
+
+ public void setAny(final A any) {
+ this.any = any;
+ }
+
+ @XmlElementWrapper(name = "propagationStatuses")
+ @XmlElement(name = "propagationStatus")
+ @JsonProperty("propagationStatuses")
+ public List<PropagationStatus> getPropagationStatuses() {
+ return propagationStatuses;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
index fc540a9..a74042f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
@@ -56,9 +56,7 @@ public class ResourceTO extends AbstractAnnotatedBean {
private final List<ProvisionTO> provisions = new ArrayList<>();
- private boolean propagationPrimary;
-
- private int propagationPriority = 0;
+ private Integer propagationPriority;
private boolean randomPwdIfNotProvided;
@@ -119,19 +117,11 @@ public class ResourceTO extends AbstractAnnotatedBean {
this.connectorDisplayName = connectorDisplayName;
}
- public boolean isPropagationPrimary() {
- return propagationPrimary;
- }
-
- public void setPropagationPrimary(final boolean propagationPrimary) {
- this.propagationPrimary = propagationPrimary;
- }
-
- public int getPropagationPriority() {
+ public Integer getPropagationPriority() {
return propagationPriority;
}
- public void setPropagationPriority(final int propagationPriority) {
+ public void setPropagationPriority(final Integer propagationPriority) {
this.propagationPriority = propagationPriority;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
index 13b30df..0b69531 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
@@ -34,6 +34,11 @@ public final class RESTHeaders {
public static final String RESOURCE_KEY = "X-Syncope-Key";
/**
+ * Asks for asynchronous propagation towards external resources with null priority.
+ */
+ public static final String NULL_PRIORITY_ASYNC = "X-Syncope-Null-Priority-Async";
+
+ /**
* Declares the type of exception being raised.
*
* @see org.apache.syncope.common.lib.types.ClientExceptionType
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
index 49899c2..ec8495c 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AnyService.java
@@ -111,7 +111,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS
*
* @param anyTO any object to be created
* @return Response object featuring Location header of created any object as well as the any
- * object itself enriched with propagation status information - AnyTO as Entity
+ * object itself enriched with propagation status information - ProvisioningResult as Entity
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@@ -123,7 +123,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS
*
* @param anyPatch modification to be applied to any object matching the provided key
* @return Response object featuring the updated any object enriched with propagation status information
- * - AnyTO as Entity
+ * - ProvisioningResult as Entity
*/
@PATCH
@Path("{key}")
@@ -153,7 +153,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS
*
* @param anyTO complete update
* @return Response object featuring the updated any object enriched with propagation status information
- * - AnyTO as Entity
+ * - ProvisioningResult as Entity
*/
@PUT
@Path("{key}")
@@ -182,7 +182,7 @@ public interface AnyService<TO extends AnyTO, P extends AnyPatch> extends JAXRSS
*
* @param key key of any object to be deleted
* @return Response object featuring the deleted any object enriched with propagation status information
- * - AnyTO as Entity
+ * - ProvisioningResult as Entity
*/
@DELETE
@Path("{key}")
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
index 745129f..21140ed 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
@@ -56,7 +56,7 @@ public interface UserSelfService extends JAXRSService {
* @param userTO user to be created
* @param storePassword whether password shall be stored internally
* @return Response object featuring Location header of self-registered user as well as the user
- * itself - UserTO as Entity
+ * itself - ProvisioningResult as Entity
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@@ -68,7 +68,7 @@ public interface UserSelfService extends JAXRSService {
* Self-updates user.
*
* @param patch modification to be applied to self
- * @return Response object featuring the updated user - UserTO as Entity
+ * @return Response object featuring the updated user - ProvisioningResult as Entity
*/
@PATCH
@Path("{key}")
@@ -80,7 +80,7 @@ public interface UserSelfService extends JAXRSService {
* Self-updates user.
*
* @param user complete update
- * @return Response object featuring the updated user - UserTO as Entity
+ * @return Response object featuring the updated user - ProvisioningResult as Entity
*/
@PUT
@Path("{key}")
@@ -91,7 +91,7 @@ public interface UserSelfService extends JAXRSService {
/**
* Self-deletes user.
*
- * @return Response object featuring the deleted user - UserTO as Entity
+ * @return Response object featuring the deleted user - ProvisioningResult as Entity
*/
@DELETE
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@@ -102,7 +102,7 @@ public interface UserSelfService extends JAXRSService {
*
* @param password the password value to update
*
- * @return Response object featuring the updated user - UserTO as Entity
+ * @return Response object featuring the updated user - ProvisioningResult as Entity
*/
@POST
@Path("changePassword")
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
index 0368ef1..e23e6cd 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java
@@ -65,7 +65,7 @@ public interface UserService extends AnyService<UserTO, UserPatch> {
* @param userTO user to be created
* @param storePassword whether password shall be stored internally
* @return Response object featuring Location header of created user as well as the user itself
- * enriched with propagation status information - UserTO as Entity
+ * enriched with propagation status information - ProvisioningResult as Entity
*/
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@@ -79,7 +79,7 @@ public interface UserService extends AnyService<UserTO, UserPatch> {
*
* @param statusPatch status update details
* @return Response object featuring the updated user enriched with propagation status information
- * - UserTO as Entity
+ * - ProvisioningResult as Entity
*/
@POST
@Path("{key}/status")
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
index 111f0ba..987595d 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
@@ -31,6 +31,8 @@ import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.patch.AnyPatch;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -111,16 +113,6 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
return ImmutablePair.of(any, actions);
}
- protected TO afterCreate(final TO input, final List<LogicActions> actions) {
- TO any = input;
-
- for (LogicActions action : actions) {
- any = action.afterCreate(any);
- }
-
- return any;
- }
-
protected Pair<P, List<LogicActions>> beforeUpdate(final P input, final String realmPath) {
Realm realm = realmDAO.find(realmPath);
if (realm == null) {
@@ -141,16 +133,6 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
return ImmutablePair.of(mod, actions);
}
- protected TO afterUpdate(final TO input, final List<LogicActions> actions) {
- TO any = input;
-
- for (LogicActions action : actions) {
- any = action.afterUpdate(any);
- }
-
- return any;
- }
-
protected Pair<TO, List<LogicActions>> beforeDelete(final TO input) {
Realm realm = realmDAO.find(input.getRealm());
if (realm == null) {
@@ -171,14 +153,20 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
return ImmutablePair.of(any, actions);
}
- protected TO afterDelete(final TO input, final List<LogicActions> actions) {
+ protected ProvisioningResult<TO> after(
+ final TO input, final List<PropagationStatus> statuses, final List<LogicActions> actions) {
+
TO any = input;
for (LogicActions action : actions) {
- any = action.afterDelete(any);
+ any = action.afterCreate(any);
}
- return any;
+ ProvisioningResult<TO> result = new ProvisioningResult<>();
+ result.setAny(any);
+ result.getPropagationStatuses().addAll(statuses);
+
+ return result;
}
private static class StartsWithPredicate implements Predicate<String> {
@@ -238,11 +226,11 @@ public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
public abstract int count(List<String> realms);
- public abstract TO create(TO anyTO);
+ public abstract ProvisioningResult<TO> create(TO anyTO, boolean nullPriorityAsync);
- public abstract TO update(P anyPatch);
+ public abstract ProvisioningResult<TO> update(P anyPatch, boolean nullPriorityAsync);
- public abstract TO delete(Long key);
+ public abstract ProvisioningResult<TO> delete(Long key, boolean nullPriorityAsync);
public abstract List<TO> list(
int page, int size, List<OrderByClause> orderBy,
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
index 6741a89..3bd4492 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
@@ -20,18 +20,23 @@ package org.apache.syncope.core.logic;
import java.util.Collection;
import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
-public abstract class AbstractResourceAssociator<T extends AnyTO> extends AbstractLogic<T> {
+public abstract class AbstractResourceAssociator<A extends AnyTO> extends AbstractLogic<A> {
- public abstract T unlink(Long id, Collection<String> resources);
+ public abstract A unlink(Long key, Collection<String> resources);
- public abstract T link(Long id, Collection<String> resources);
+ public abstract A link(Long key, Collection<String> resources);
- public abstract T unassign(Long id, Collection<String> resources);
+ public abstract ProvisioningResult<A> unassign(
+ Long key, Collection<String> resources, boolean nullPriorityAsync);
- public abstract T assign(Long id, Collection<String> resources, boolean changepwd, String password);
+ public abstract ProvisioningResult<A> assign(
+ Long key, Collection<String> resources, boolean changepwd, String password, boolean nullPriorityAsync);
- public abstract T deprovision(Long userId, Collection<String> resources);
+ public abstract ProvisioningResult<A> deprovision(
+ Long key, Collection<String> resources, boolean nullPriorityAsync);
- public abstract T provision(Long userId, Collection<String> resources, boolean changepwd, String password);
+ public abstract ProvisioningResult<A> provision(
+ Long key, Collection<String> resources, boolean changepwd, String password, boolean nullPriorityAsync);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
index de0130e..b3f7a4a 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyObjectLogic.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
@@ -37,6 +36,7 @@ import org.apache.syncope.common.lib.patch.AnyObjectPatch;
import org.apache.syncope.common.lib.patch.StringPatchItem;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.Entitlement;
@@ -147,7 +147,7 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_CREATE + "')")
@Override
- public AnyObjectTO create(final AnyObjectTO anyObjectTO) {
+ public ProvisioningResult<AnyObjectTO> create(final AnyObjectTO anyObjectTO, final boolean nullPriorityAsync) {
Pair<AnyObjectTO, List<LogicActions>> before = beforeCreate(anyObjectTO);
if (before.getLeft().getRealm() == null) {
@@ -163,16 +163,17 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
throw SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
}
- Map.Entry<Long, List<PropagationStatus>> created = provisioningManager.create(before.getLeft());
- AnyObjectTO savedTO = binder.getAnyObjectTO(created.getKey());
- savedTO.getPropagationStatusTOs().addAll(created.getValue());
+ Pair<Long, List<PropagationStatus>> created =
+ provisioningManager.create(before.getLeft(), nullPriorityAsync);
- return afterCreate(savedTO, before.getValue());
+ return after(binder.getAnyObjectTO(created.getKey()), created.getRight(), before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_UPDATE + "')")
@Override
- public AnyObjectTO update(final AnyObjectPatch anyObjectPatch) {
+ public ProvisioningResult<AnyObjectTO> update(
+ final AnyObjectPatch anyObjectPatch, final boolean nullPriorityAsync) {
+
AnyObjectTO anyObjectTO = binder.getAnyObjectTO(anyObjectPatch.getKey());
Pair<AnyObjectPatch, List<LogicActions>> before = beforeUpdate(anyObjectPatch, anyObjectTO.getRealm());
@@ -185,17 +186,15 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
securityChecks(effectiveRealms, before.getLeft().getRealm().getValue(), before.getLeft().getKey());
}
- Map.Entry<Long, List<PropagationStatus>> updated = provisioningManager.update(anyObjectPatch);
-
- AnyObjectTO updatedTO = binder.getAnyObjectTO(updated.getKey());
- updatedTO.getPropagationStatusTOs().addAll(updated.getValue());
+ Pair<Long, List<PropagationStatus>> updated =
+ provisioningManager.update(anyObjectPatch, nullPriorityAsync);
- return afterUpdate(updatedTO, before.getRight());
+ return after(binder.getAnyObjectTO(updated.getKey()), updated.getRight(), before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_DELETE + "')")
@Override
- public AnyObjectTO delete(final Long key) {
+ public ProvisioningResult<AnyObjectTO> delete(final Long key, final boolean nullPriorityAsync) {
AnyObjectTO anyObject = binder.getAnyObjectTO(key);
Pair<AnyObjectTO, List<LogicActions>> before = beforeDelete(anyObject);
@@ -204,13 +203,12 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
Collections.singleton(before.getLeft().getRealm()));
securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey());
- List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey());
+ List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync);
AnyObjectTO anyObjectTO = new AnyObjectTO();
anyObjectTO.setKey(before.getLeft().getKey());
- anyObjectTO.getPropagationStatusTOs().addAll(statuses);
- return afterDelete(anyObjectTO, before.getRight());
+ return after(anyObjectTO, statuses, before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_UPDATE + "')")
@@ -261,7 +259,9 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_UPDATE + "')")
@Override
- public AnyObjectTO unassign(final Long key, final Collection<String> resources) {
+ public ProvisioningResult<AnyObjectTO> unassign(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
// security checks
AnyObjectTO anyObject = binder.getAnyObjectTO(key);
Set<String> effectiveRealms = getEffectiveRealms(
@@ -279,16 +279,17 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
}
}));
- return update(patch);
+ return update(patch, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_UPDATE + "')")
@Override
- public AnyObjectTO assign(
+ public ProvisioningResult<AnyObjectTO> assign(
final Long key,
final Collection<String> resources,
final boolean changepwd,
- final String password) {
+ final String password,
+ final boolean nullPriorityAsync) {
// security checks
AnyObjectTO anyObject = binder.getAnyObjectTO(key);
@@ -307,12 +308,14 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
}
}));
- return update(patch);
+ return update(patch, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_UPDATE + "')")
@Override
- public AnyObjectTO deprovision(final Long key, final Collection<String> resources) {
+ public ProvisioningResult<AnyObjectTO> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
// security checks
AnyObjectTO anyObject = binder.getAnyObjectTO(key);
Set<String> effectiveRealms = getEffectiveRealms(
@@ -320,20 +323,22 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
Collections.singleton(anyObject.getRealm()));
securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
- List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources);
+ List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
- AnyObjectTO updatedTO = binder.getAnyObjectTO(key);
- updatedTO.getPropagationStatusTOs().addAll(statuses);
- return updatedTO;
+ ProvisioningResult<AnyObjectTO> result = new ProvisioningResult<>();
+ result.setAny(binder.getAnyObjectTO(key));
+ result.getPropagationStatuses().addAll(statuses);
+ return result;
}
@PreAuthorize("hasRole('" + Entitlement.ANY_OBJECT_UPDATE + "')")
@Override
- public AnyObjectTO provision(
+ public ProvisioningResult<AnyObjectTO> provision(
final Long key,
final Collection<String> resources,
final boolean changePwd,
- final String password) {
+ final String password,
+ final boolean nullPriorityAsync) {
// security checks
AnyObjectTO anyObject = binder.getAnyObjectTO(key);
@@ -342,8 +347,12 @@ public class AnyObjectLogic extends AbstractAnyLogic<AnyObjectTO, AnyObjectPatch
Collections.singleton(anyObject.getRealm()));
securityChecks(effectiveRealms, anyObject.getRealm(), anyObject.getKey());
- anyObject.getPropagationStatusTOs().addAll(provisioningManager.provision(key, resources));
- return anyObject;
+ List<PropagationStatus> statuses = provisioningManager.provision(key, resources, nullPriorityAsync);
+
+ ProvisioningResult<AnyObjectTO> result = new ProvisioningResult<>();
+ result.setAny(binder.getAnyObjectTO(key));
+ result.getPropagationStatuses().addAll(statuses);
+ return result;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
index a563088..60249f2 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/GroupLogic.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
@@ -38,6 +37,7 @@ import org.apache.syncope.common.lib.patch.GroupPatch;
import org.apache.syncope.common.lib.patch.StringPatchItem;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.Entitlement;
@@ -171,7 +171,7 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
@PreAuthorize("hasRole('" + Entitlement.GROUP_CREATE + "')")
@Override
- public GroupTO create(final GroupTO groupTO) {
+ public ProvisioningResult<GroupTO> create(final GroupTO groupTO, final boolean nullPriorityAsync) {
Pair<GroupTO, List<LogicActions>> before = beforeCreate(groupTO);
if (before.getLeft().getRealm() == null) {
@@ -183,16 +183,15 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
Collections.singleton(before.getLeft().getRealm()));
securityChecks(effectiveRealms, before.getLeft().getRealm(), null);
- Map.Entry<Long, List<PropagationStatus>> created = provisioningManager.create(before.getLeft());
- GroupTO savedTO = binder.getGroupTO(created.getKey());
- savedTO.getPropagationStatusTOs().addAll(created.getValue());
+ Pair<Long, List<PropagationStatus>> created =
+ provisioningManager.create(before.getLeft(), nullPriorityAsync);
- return afterCreate(savedTO, before.getValue());
+ return after(binder.getGroupTO(created.getKey()), created.getRight(), before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.GROUP_UPDATE + "')")
@Override
- public GroupTO update(final GroupPatch groupPatch) {
+ public ProvisioningResult<GroupTO> update(final GroupPatch groupPatch, final boolean nullPriorityAsync) {
GroupTO groupTO = binder.getGroupTO(groupPatch.getKey());
Pair<GroupPatch, List<LogicActions>> before = beforeUpdate(groupPatch, groupTO.getRealm());
@@ -205,17 +204,14 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
securityChecks(effectiveRealms, before.getLeft().getRealm().getValue(), before.getLeft().getKey());
}
- Map.Entry<Long, List<PropagationStatus>> updated = provisioningManager.update(groupPatch);
+ Pair<Long, List<PropagationStatus>> updated = provisioningManager.update(groupPatch, nullPriorityAsync);
- GroupTO updatedTO = binder.getGroupTO(updated.getKey());
- updatedTO.getPropagationStatusTOs().addAll(updated.getValue());
-
- return afterUpdate(updatedTO, before.getRight());
+ return after(binder.getGroupTO(updated.getKey()), updated.getRight(), before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.GROUP_DELETE + "')")
@Override
- public GroupTO delete(final Long key) {
+ public ProvisioningResult<GroupTO> delete(final Long key, final boolean nullPriorityAsync) {
GroupTO group = binder.getGroupTO(key);
Pair<GroupTO, List<LogicActions>> before = beforeDelete(group);
@@ -237,13 +233,12 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
throw sce;
}
- List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey());
+ List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync);
GroupTO groupTO = new GroupTO();
groupTO.setKey(before.getLeft().getKey());
- groupTO.getPropagationStatusTOs().addAll(statuses);
- return afterDelete(groupTO, before.getRight());
+ return after(groupTO, statuses, before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.GROUP_UPDATE + "')")
@@ -294,7 +289,9 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
@PreAuthorize("hasRole('" + Entitlement.GROUP_UPDATE + "')")
@Override
- public GroupTO unassign(final Long key, final Collection<String> resources) {
+ public ProvisioningResult<GroupTO> unassign(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
// security checks
GroupTO group = binder.getGroupTO(key);
Set<String> effectiveRealms = getEffectiveRealms(
@@ -312,16 +309,17 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
}
}));
- return update(patch);
+ return update(patch, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.GROUP_UPDATE + "')")
@Override
- public GroupTO assign(
+ public ProvisioningResult<GroupTO> assign(
final Long key,
final Collection<String> resources,
final boolean changepwd,
- final String password) {
+ final String password,
+ final boolean nullPriorityAsync) {
// security checks
GroupTO group = binder.getGroupTO(key);
@@ -340,12 +338,14 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
}
}));
- return update(patch);
+ return update(patch, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.GROUP_UPDATE + "')")
@Override
- public GroupTO deprovision(final Long key, final Collection<String> resources) {
+ public ProvisioningResult<GroupTO> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
// security checks
GroupTO group = binder.getGroupTO(key);
Set<String> effectiveRealms = getEffectiveRealms(
@@ -353,20 +353,22 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
Collections.singleton(group.getRealm()));
securityChecks(effectiveRealms, group.getRealm(), group.getKey());
- List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources);
+ List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
- GroupTO updatedTO = binder.getGroupTO(key);
- updatedTO.getPropagationStatusTOs().addAll(statuses);
- return updatedTO;
+ ProvisioningResult<GroupTO> result = new ProvisioningResult<>();
+ result.setAny(binder.getGroupTO(key));
+ result.getPropagationStatuses().addAll(statuses);
+ return result;
}
@PreAuthorize("hasRole('" + Entitlement.GROUP_UPDATE + "')")
@Override
- public GroupTO provision(
+ public ProvisioningResult<GroupTO> provision(
final Long key,
final Collection<String> resources,
final boolean changePwd,
- final String password) {
+ final String password,
+ final boolean nullPriorityAsync) {
// security checks
GroupTO group = binder.getGroupTO(key);
@@ -375,8 +377,12 @@ public class GroupLogic extends AbstractAnyLogic<GroupTO, GroupPatch> {
Collections.singleton(group.getRealm()));
securityChecks(effectiveRealms, group.getRealm(), group.getKey());
- group.getPropagationStatusTOs().addAll(provisioningManager.provision(key, resources));
- return group;
+ List<PropagationStatus> statuses = provisioningManager.provision(key, resources, nullPriorityAsync);
+
+ ProvisioningResult<GroupTO> result = new ProvisioningResult<>();
+ result.setAny(binder.getGroupTO(key));
+ result.getPropagationStatuses().addAll(statuses);
+ return result;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index deab762..22b7ab5 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
@@ -39,6 +38,7 @@ import org.apache.syncope.common.lib.patch.StatusPatch;
import org.apache.syncope.common.lib.patch.StringPatchItem;
import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -169,22 +169,31 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
}
@PreAuthorize("isAnonymous() or hasRole('" + Entitlement.ANONYMOUS + "')")
- public UserTO selfCreate(final UserTO userTO, final boolean storePassword) {
- return doCreate(userTO, storePassword, true);
+ public ProvisioningResult<UserTO> selfCreate(
+ final UserTO userTO, final boolean storePassword, final boolean nullPriorityAsync) {
+
+ return doCreate(userTO, storePassword, true, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.USER_CREATE + "')")
@Override
- public UserTO create(final UserTO userTO) {
- return create(userTO, true);
+ public ProvisioningResult<UserTO> create(final UserTO userTO, final boolean nullPriorityAsync) {
+ return doCreate(userTO, true, false, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.USER_CREATE + "')")
- public UserTO create(final UserTO userTO, final boolean storePassword) {
- return doCreate(userTO, storePassword, false);
+ public ProvisioningResult<UserTO> create(
+ final UserTO userTO, final boolean storePassword, final boolean nullPriorityAsync) {
+
+ return doCreate(userTO, storePassword, false, nullPriorityAsync);
}
- protected UserTO doCreate(final UserTO userTO, final boolean storePassword, final boolean self) {
+ protected ProvisioningResult<UserTO> doCreate(
+ final UserTO userTO,
+ final boolean storePassword,
+ final boolean self,
+ final boolean nullPriorityAsync) {
+
Pair<UserTO, List<LogicActions>> before = beforeCreate(userTO);
if (before.getLeft().getRealm() == null) {
@@ -198,28 +207,28 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
securityChecks(effectiveRealms, before.getLeft().getRealm(), null);
}
- Map.Entry<Long, List<PropagationStatus>> created = provisioningManager.create(before.getLeft(), storePassword);
+ Pair<Long, List<PropagationStatus>> created =
+ provisioningManager.create(before.getLeft(), storePassword, nullPriorityAsync);
- UserTO savedTO = binder.getUserTO(created.getKey());
- savedTO.getPropagationStatusTOs().addAll(created.getValue());
-
- return binder.returnUserTO(afterCreate(savedTO, before.getValue()));
+ return after(binder.returnUserTO(binder.getUserTO(created.getKey())), created.getRight(), before.getRight());
}
@PreAuthorize("isAuthenticated() and not(hasRole('" + Entitlement.ANONYMOUS + "'))")
- public UserTO selfUpdate(final UserPatch userPatch) {
+ public ProvisioningResult<UserTO> selfUpdate(final UserPatch userPatch, final boolean nullPriorityAsync) {
UserTO userTO = binder.getAuthenticatedUserTO();
userPatch.setKey(userTO.getKey());
- return doUpdate(userPatch, true);
+ return doUpdate(userPatch, true, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
@Override
- public UserTO update(final UserPatch userPatch) {
- return doUpdate(userPatch, false);
+ public ProvisioningResult<UserTO> update(final UserPatch userPatch, final boolean nullPriorityAsync) {
+ return doUpdate(userPatch, false, nullPriorityAsync);
}
- protected UserTO doUpdate(final UserPatch userPatch, final boolean self) {
+ protected ProvisioningResult<UserTO> doUpdate(
+ final UserPatch userPatch, final boolean self, final boolean nullPriorityAsync) {
+
UserTO userTO = binder.getUserTO(userPatch.getKey());
Pair<UserPatch, List<LogicActions>> before = beforeUpdate(userPatch, userTO.getRealm());
@@ -235,29 +244,28 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
securityChecks(effectiveRealms, before.getLeft().getRealm().getValue(), before.getLeft().getKey());
}
- Map.Entry<Long, List<PropagationStatus>> updated = provisioningManager.update(before.getLeft());
-
- UserTO updatedTO = binder.getUserTO(updated.getKey());
- updatedTO.getPropagationStatusTOs().addAll(updated.getValue());
+ Pair<Long, List<PropagationStatus>> updated = provisioningManager.update(before.getLeft(), nullPriorityAsync);
- return binder.returnUserTO(afterUpdate(updatedTO, before.getRight()));
+ return after(binder.returnUserTO(binder.getUserTO(updated.getKey())), updated.getRight(), before.getRight());
}
- protected Map.Entry<Long, List<PropagationStatus>> setStatusOnWfAdapter(final StatusPatch statusPatch) {
- Map.Entry<Long, List<PropagationStatus>> updated;
+ protected Pair<Long, List<PropagationStatus>> setStatusOnWfAdapter(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
+ Pair<Long, List<PropagationStatus>> updated;
switch (statusPatch.getType()) {
case SUSPEND:
- updated = provisioningManager.suspend(statusPatch);
+ updated = provisioningManager.suspend(statusPatch, nullPriorityAsync);
break;
case REACTIVATE:
- updated = provisioningManager.reactivate(statusPatch);
+ updated = provisioningManager.reactivate(statusPatch, nullPriorityAsync);
break;
case ACTIVATE:
default:
- updated = provisioningManager.activate(statusPatch);
+ updated = provisioningManager.activate(statusPatch, nullPriorityAsync);
break;
}
@@ -266,7 +274,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
}
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
- public UserTO status(final StatusPatch statusPatch) {
+ public ProvisioningResult<UserTO> status(final StatusPatch statusPatch, final boolean nullPriorityAsync) {
// security checks
UserTO toUpdate = binder.getUserTO(statusPatch.getKey());
Set<String> effectiveRealms = getEffectiveRealms(
@@ -274,18 +282,20 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
Collections.singleton(toUpdate.getRealm()));
securityChecks(effectiveRealms, toUpdate.getRealm(), toUpdate.getKey());
- Map.Entry<Long, List<PropagationStatus>> updated = setStatusOnWfAdapter(statusPatch);
- UserTO savedTO = binder.getUserTO(updated.getKey());
- savedTO.getPropagationStatusTOs().addAll(updated.getValue());
- return binder.returnUserTO(savedTO);
+ Pair<Long, List<PropagationStatus>> updated = setStatusOnWfAdapter(statusPatch, nullPriorityAsync);
+
+ return after(
+ binder.returnUserTO(binder.getUserTO(updated.getKey())),
+ updated.getRight(),
+ Collections.<LogicActions>emptyList());
}
@PreAuthorize("hasRole('" + Entitlement.MUST_CHANGE_PASSWORD + "')")
- public UserTO changePassword(final String password) {
+ public ProvisioningResult<UserTO> changePassword(final String password, final boolean nullPriorityAsync) {
UserPatch userPatch = new UserPatch();
userPatch.setPassword(new PasswordPatch.Builder().value(password).build());
userPatch.setMustChangePassword(new BooleanReplacePatchItem.Builder().value(false).build());
- return selfUpdate(userPatch);
+ return selfUpdate(userPatch, nullPriorityAsync);
}
@PreAuthorize("isAnonymous() or hasRole('" + Entitlement.ANONYMOUS + "')")
@@ -320,19 +330,21 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
}
@PreAuthorize("isAuthenticated() and not(hasRole('" + Entitlement.ANONYMOUS + "'))")
- public UserTO selfDelete() {
+ public ProvisioningResult<UserTO> selfDelete(final boolean nullPriorityAsync) {
UserTO userTO = binder.getAuthenticatedUserTO();
- return doDelete(userTO, true);
+ return doDelete(userTO, true, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.USER_DELETE + "')")
@Override
- public UserTO delete(final Long key) {
+ public ProvisioningResult<UserTO> delete(final Long key, final boolean nullPriorityAsync) {
UserTO userTO = binder.getUserTO(key);
- return doDelete(userTO, false);
+ return doDelete(userTO, false, nullPriorityAsync);
}
- protected UserTO doDelete(final UserTO userTO, final boolean self) {
+ protected ProvisioningResult<UserTO> doDelete(
+ final UserTO userTO, final boolean self, final boolean nullPriorityAsync) {
+
Pair<UserTO, List<LogicActions>> before = beforeDelete(userTO);
if (!self) {
@@ -355,7 +367,7 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
throw sce;
}
- List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey());
+ List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync);
UserTO deletedTO;
if (userDAO.find(before.getLeft().getKey()) == null) {
@@ -364,9 +376,8 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
} else {
deletedTO = binder.getUserTO(before.getLeft().getKey());
}
- deletedTO.getPropagationStatusTOs().addAll(statuses);
- return binder.returnUserTO(afterDelete(deletedTO, before.getRight()));
+ return after(binder.returnUserTO(deletedTO), statuses, before.getRight());
}
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
@@ -417,7 +428,9 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
@Override
- public UserTO unassign(final Long key, final Collection<String> resources) {
+ public ProvisioningResult<UserTO> unassign(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
// security checks
UserTO user = binder.getUserTO(key);
Set<String> effectiveRealms = getEffectiveRealms(
@@ -435,16 +448,17 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
}
}));
- return update(patch);
+ return update(patch, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
@Override
- public UserTO assign(
+ public ProvisioningResult<UserTO> assign(
final Long key,
final Collection<String> resources,
final boolean changepwd,
- final String password) {
+ final String password,
+ final boolean nullPriorityAsync) {
// security checks
UserTO user = binder.getUserTO(key);
@@ -468,12 +482,14 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
value(password).onSyncope(false).resources(resources).build());
}
- return update(patch);
+ return update(patch, nullPriorityAsync);
}
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
@Override
- public UserTO deprovision(final Long key, final Collection<String> resources) {
+ public ProvisioningResult<UserTO> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
// security checks
UserTO user = binder.getUserTO(key);
Set<String> effectiveRealms = getEffectiveRealms(
@@ -481,20 +497,22 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
Collections.singleton(user.getRealm()));
securityChecks(effectiveRealms, user.getRealm(), user.getKey());
- List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources);
+ List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
- UserTO updatedTO = binder.getUserTO(key);
- updatedTO.getPropagationStatusTOs().addAll(statuses);
- return binder.returnUserTO(updatedTO);
+ ProvisioningResult<UserTO> result = new ProvisioningResult<>();
+ result.setAny(binder.returnUserTO(binder.getUserTO(key)));
+ result.getPropagationStatuses().addAll(statuses);
+ return result;
}
@PreAuthorize("hasRole('" + Entitlement.USER_UPDATE + "')")
@Override
- public UserTO provision(
+ public ProvisioningResult<UserTO> provision(
final Long key,
final Collection<String> resources,
final boolean changePwd,
- final String password) {
+ final String password,
+ final boolean nullPriorityAsync) {
// security checks
UserTO user = binder.getUserTO(key);
@@ -503,8 +521,13 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
Collections.singleton(user.getRealm()));
securityChecks(effectiveRealms, user.getRealm(), user.getKey());
- user.getPropagationStatusTOs().addAll(provisioningManager.provision(key, changePwd, password, resources));
- return binder.returnUserTO(user);
+ List<PropagationStatus> statuses =
+ provisioningManager.provision(key, changePwd, password, resources, nullPriorityAsync);
+
+ ProvisioningResult<UserTO> result = new ProvisioningResult<>();
+ result.setAny(binder.returnUserTO(binder.getUserTO(key)));
+ result.getPropagationStatuses().addAll(statuses);
+ return result;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
index 0cc3c04..968b779 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
@@ -87,10 +87,6 @@ public interface ExternalResource extends AnnotatedEntity<String> {
void setEnforceMandatoryCondition(boolean enforce);
- boolean isPropagationPrimary();
-
- void setPropagationPrimary(boolean condition);
-
boolean isRandomPwdIfNotProvided();
void setRandomPwdIfNotProvided(boolean condition);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
index 2d19436..842cf86 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/task/PropagationTask.java
@@ -34,6 +34,8 @@ public interface PropagationTask extends Task {
void setOldConnObjectKey(String oldConnObjectKey);
+ String getSerializedAttributes();
+
Set<Attribute> getAttributes();
void setAttributes(Set<Attribute> attributes);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAExternalResource.java
----------------------------------------------------------------------
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 393338b..0653cf3 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
@@ -100,18 +100,8 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
private List<JPAProvision> provisions = new ArrayList<>();
/**
- * Is this resource primary, for propagations?
- */
- @NotNull
- @Basic
- @Min(0)
- @Max(1)
- private Integer propagationPrimary;
-
- /**
* Priority index for propagation ordering.
*/
- @NotNull
private Integer propagationPriority;
/**
@@ -182,7 +172,6 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
super();
enforceMandatoryCondition = getBooleanAsInteger(false);
- propagationPrimary = 0;
propagationPriority = 0;
randomPwdIfNotProvided = 0;
overrideCapabilities = 0;
@@ -254,16 +243,6 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public boolean isPropagationPrimary() {
- return isBooleanAsInteger(propagationPrimary);
- }
-
- @Override
- public void setPropagationPrimary(final boolean propagationPrimary) {
- this.propagationPrimary = getBooleanAsInteger(propagationPrimary);
- }
-
- @Override
public Integer getPropagationPriority() {
return propagationPriority;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
index 9882752..94c7d8d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPropagationTask.java
@@ -68,7 +68,7 @@ public class JPAPropagationTask extends AbstractTask implements PropagationTask
* Attributes to be propagated.
*/
@Lob
- private String xmlAttributes;
+ private String attributes;
private String objectClassName;
@@ -111,18 +111,23 @@ public class JPAPropagationTask extends AbstractTask implements PropagationTask
}
@Override
+ public String getSerializedAttributes() {
+ return this.attributes;
+ }
+
+ @Override
public Set<Attribute> getAttributes() {
- Set<Attribute> attributes = new HashSet<>();
- if (!StringUtils.isBlank(xmlAttributes)) {
- CollectionUtils.addAll(attributes, POJOHelper.deserialize(xmlAttributes, Attribute[].class));
+ Set<Attribute> result = new HashSet<>();
+ if (StringUtils.isNotBlank(this.attributes)) {
+ CollectionUtils.addAll(result, POJOHelper.deserialize(this.attributes, Attribute[].class));
}
- return attributes;
+ return result;
}
@Override
public void setAttributes(final Set<Attribute> attributes) {
- xmlAttributes = POJOHelper.serialize(attributes);
+ this.attributes = POJOHelper.serialize(attributes);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
index 0fc2a3e..be37d88 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
@@ -105,7 +105,6 @@ public class ResourceTest extends AbstractTest {
ExternalResource resource = entityFactory.newEntity(ExternalResource.class);
resource.setKey("ws-target-resource-basic-save");
resource.setPropagationPriority(2);
- resource.setPropagationPrimary(true);
Provision provision = entityFactory.newEntity(Provision.class);
provision.setAnyType(anyTypeDAO.findUser());
@@ -135,7 +134,6 @@ public class ResourceTest extends AbstractTest {
assertNotNull(actual.getProvision(anyTypeDAO.findUser()).getMapping());
assertFalse(actual.getProvision(anyTypeDAO.findUser()).getMapping().getItems().isEmpty());
assertEquals(Integer.valueOf(2), actual.getPropagationPriority());
- assertTrue(actual.isPropagationPrimary());
}
@Test(expected = InvalidEntityException.class)
@@ -264,7 +262,6 @@ public class ResourceTest extends AbstractTest {
ExternalResource resource = entityFactory.newEntity(ExternalResource.class);
resource.setKey("ws-target-resource-virtual-mapping");
resource.setPropagationPriority(2);
- resource.setPropagationPrimary(true);
Provision provision = entityFactory.newEntity(Provision.class);
provision.setAnyType(anyTypeDAO.findUser());
[33/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
index 2bc840d..20baa6b 100644
--- a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
@@ -581,64 +581,64 @@ under the License.
<ExternalResource name="ws-target-resource-1" connector_id="100"
randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="1" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ propagationPriority="1" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-2" connector_id="100"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="FAILURES" deleteTraceLevel="NONE" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="FAILURES" deleteTraceLevel="NONE" updateTraceLevel="ALL" syncTraceLevel="ALL"
syncPolicy_id="9"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-timeout" connector_id="102"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="1" createTraceLevel="FAILURES" deleteTraceLevel="NONE" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ propagationPriority="1" createTraceLevel="FAILURES" deleteTraceLevel="NONE" updateTraceLevel="ALL" syncTraceLevel="ALL"
jsonConf='[{"schema":{"name":"endpoint","displayName":null,"helpMessage":null,"type":"java.lang.String","required":true,"order":0,"confidential":false,"defaultValues":null},"overridable":true,"values":["http://localhost:${cargo.servlet.port}/syncope-fit-build-tools/services/provisioning"]}]'
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-list-mappings-1" connector_id="100"
randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-list-mappings-2" connector_id="100"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-delete" connector_id="102"
randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
- propagationPriority="2" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ propagationPriority="2" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-update" connector_id="100"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-testdb" connector_id="101"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-testdb2" connector_id="106"
randomPwdIfNotProvided="1" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-csv" connector_id="104"
randomPwdIfNotProvided="0" enforceMandatoryCondition="0" overrideCapabilities="0"
syncPolicy_id="3"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-update-resetsynctoken" connector_id="100" enforceMandatoryCondition="1"
- randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-ldap" connector_id="105"
randomPwdIfNotProvided="1" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="1"
+ propagationPriority="1"
createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -646,7 +646,7 @@ under the License.
actionClassName="org.apache.syncope.core.provisioning.java.propagation.LDAPMembershipPropagationActions"/>
<ExternalResource name="ws-target-resource-nopropagation" connector_id="103"
randomPwdIfNotProvided="0" enforceMandatoryCondition="1" overrideCapabilities="0"
- propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
passwordPolicy_id="4"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -654,17 +654,17 @@ under the License.
<!-- The following three resources have been added to verify the issue SYNCOPE-68 -->
<ExternalResource name="ws-target-resource-nopropagation2" connector_id="103"
enforceMandatoryCondition="1" overrideCapabilities="0"
- randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-nopropagation3" connector_id="103"
enforceMandatoryCondition="1" overrideCapabilities="0"
- randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="ws-target-resource-nopropagation4" connector_id="103"
enforceMandatoryCondition="1" overrideCapabilities="0"
- randomPwdIfNotProvided="0" propagationPriority="0" propagationPrimary="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
+ randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" updateTraceLevel="ALL" syncTraceLevel="ALL"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -672,7 +672,7 @@ under the License.
<ExternalResource name="resource-db-sync" connector_id="107"
randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" syncTraceLevel="ALL" updateTraceLevel="ALL"
enforceMandatoryCondition="0"
- propagationPrimary="0" propagationPriority="0" overrideCapabilities="0"
+ overrideCapabilities="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -680,14 +680,14 @@ under the License.
<ExternalResource name="resource-db-virattr" connector_id="107"
randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" syncTraceLevel="ALL" updateTraceLevel="ALL"
enforceMandatoryCondition="0"
- propagationPrimary="0" propagationPriority="0" overrideCapabilities="0"
+ overrideCapabilities="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
<ExternalResource name="resource-db-scripted" connector_id="108"
randomPwdIfNotProvided="0" createTraceLevel="ALL" deleteTraceLevel="ALL" syncTraceLevel="ALL" updateTraceLevel="ALL"
enforceMandatoryCondition="0"
- propagationPrimary="0" propagationPriority="0" overrideCapabilities="0"
+ overrideCapabilities="0"
creator="admin" lastModifier="admin"
creationDate="2010-10-20 11:00:00" lastChangeDate="2010-10-20 11:00:00"/>
@@ -968,34 +968,34 @@ under the License.
<Task DTYPE="PropagationTask" type="PROPAGATION" id="1" operation="UPDATE"
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-2" anyTypeKind="USER" anyKey="1"
- xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
+ attributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
<TaskExec id="1" task_id="1" status="SUCCESS"/>
<Task DTYPE="PropagationTask" type="PROPAGATION" id="2" operation="CREATE"
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-2" anyTypeKind="USER" anyKey="1"
- xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
+ attributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
<Task DTYPE="PropagationTask" type="PROPAGATION" id="3" operation="DELETE"
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-2" anyTypeKind="USER" anyKey="1"
- xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"type","value":["type"]}]'/>
+ attributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"type","value":["type"]}]'/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="4" name="CSV (update matching; assign unmatching)" resource_name="resource-csv"
destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
unmatchingRule="ASSIGN" matchingRule="UPDATE"/>
<AnyTemplateSyncTask id="41" syncTask_id="4" anyType_name="USER"
- template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":["csv"],"derAttrs":[{"schema":"cn","readonly":false,"values":[""]}],"virAttrs":[],"resources":["resource-testdb"],"propagationStatuses":[],"relationships":[],"memberships":[{"leftType":null,"leftKey":0,"rightType":"GROUP","rightKey":8,"groupName":null}],"dynGroups":[],"roles":[],"dynRoles":[],"plainAttrs":[{"schema":"type","readonly":false,"values":["email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"]}]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":["csv"],"derAttrs":[{"schema":"cn","readonly":false,"values":[""]}],"virAttrs":[],"resources":["resource-testdb"],"relationships":[],"memberships":[{"leftType":null,"leftKey":0,"rightType":"GROUP","rightKey":8,"groupName":null}],"dynGroups":[],"roles":[],"dynRoles":[],"plainAttrs":[{"schema":"type","readonly":false,"values":["email == 'test8@syncope.apache.org'? 'TYPE_8': 'TYPE_OTHER'"]}]}'/>
<AnyTemplateSyncTask id="42" syncTask_id="4" anyType_name="GROUP"
- template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"plainAttrs":[]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"plainAttrs":[]}'/>
<Task DTYPE="SchedTask" type="SCHEDULED" id="5" name="SampleJob Task"
jobDelegateClassName="org.apache.syncope.fit.core.reference.TestSampleJobDelegate" cronExpression="0 0 0 1 * ?"/>
<Task DTYPE="PropagationTask" type="PROPAGATION" id="6" operation="UPDATE"
objectClassName="__ACCOUNT__" resource_name="ws-target-resource-nopropagation" anyTypeKind="USER" anyKey="1"
- xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
+ attributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
<TaskExec id="6" task_id="6" status="SUCCESS"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="7" name="TestDB Task" resource_name="resource-testdb"
destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="0" syncStatus="1" fullReconciliation="1"
unmatchingRule="PROVISION" matchingRule="UPDATE"/>
<AnyTemplateSyncTask id="71" syncTask_id="7" anyType_name="USER"
- template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"relationships":[],"memberships":[],"dynGroups":[],"roles":[],"dynRoles":[],"plainAttrs":[{"schema":"type","readonly":false,"values":["'type a'"]},{"schema":"userId","readonly":false,"values":["'reconciled@syncope.apache.org'"]},{"schema":"fullname","readonly":false,"values":["'reconciled fullname'"]},{"schema":"surname","readonly":false,"values":["'surname'"]}]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"relationships":[],"memberships":[],"dynGroups":[],"roles":[],"dynRoles":[],"plainAttrs":[{"schema":"type","readonly":false,"values":["'type a'"]},{"schema":"userId","readonly":false,"values":["'reconciled@syncope.apache.org'"]},{"schema":"fullname","readonly":false,"values":["'reconciled fullname'"]},{"schema":"surname","readonly":false,"values":["'surname'"]}]}'/>
<AnyTemplateSyncTask id="72" syncTask_id="7" anyType_name="GROUP"
- template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"plainAttrs":[]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"plainAttrs":[]}'/>
<Task DTYPE="NotificationTask" type="NOTIFICATION" id="8" sender="admin@prova.org" subject="Notification for SYNCOPE-81"
textBody="NOTIFICATION-81" htmlBody="NOTIFICATION-81" traceLevel="ALL"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="9" name="TestDB2 Task" resource_name="resource-testdb2"
@@ -1008,9 +1008,9 @@ under the License.
destinationRealm_id="1" fullReconciliation="1" performCreate="1" performDelete="1" performUpdate="1" syncStatus="0"
unmatchingRule="PROVISION" matchingRule="UPDATE"/>
<AnyTemplateSyncTask id="1" syncTask_id="11" anyType_name="USER"
- template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[{"schema":"virtualReadOnly","readonly":true,"values":[""]}],"resources":["resource-ldap"],"propagationStatuses":[],"roles":[],"dynRoles":[],"relationships":[],"memberships":[],"dynGroups":[],"plainAttrs":[]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[{"schema":"virtualReadOnly","readonly":true,"values":[""]}],"resources":["resource-ldap"],"roles":[],"dynRoles":[],"relationships":[],"memberships":[],"dynGroups":[],"plainAttrs":[]}'/>
<AnyTemplateSyncTask id="2" syncTask_id="11" anyType_name="GROUP"
- template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"plainAttrs":[{"schema":"show","readonly":false,"values":["true"]}]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"plainAttrs":[{"schema":"show","readonly":false,"values":["true"]}]}'/>
<SyncTask_actionsClassNames SyncTask_id="11" actionClassName="org.apache.syncope.core.provisioning.java.sync.LDAPMembershipSyncActions"/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="12" name="VirAttrCache test" resource_name="resource-csv"
destinationRealm_id="1" performCreate="0" performUpdate="1" performDelete="0" syncStatus="0" fullReconciliation="1"
@@ -1075,9 +1075,9 @@ under the License.
destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
unmatchingRule="PROVISION" matchingRule="UPDATE"/>
<AnyTemplateSyncTask id="3" syncTask_id="24" anyType_name="USER"
- template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":["resource-testdb"],"propagationStatuses":[],"roles":[],"dynRoles":[],"relationships":[],"memberships":[],"dynGroups":[],"plainAttrs":[{"schema":"firstname","readonly":false,"values":[""]},{"schema":"userId","readonly":false,"values":["'test'"]},{"schema":"fullname","readonly":false,"values":["'test'"]},{"schema":"surname","readonly":false,"values":["'test'"]}]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.UserTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"USER","realm":null,"status":null,"password":null,"token":null,"tokenExpireTime":null,"username":null,"lastLoginDate":null,"changePwdDate":null,"failedLogins":null,"securityQuestion":null,"securityAnswer":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":["resource-testdb"],"roles":[],"dynRoles":[],"relationships":[],"memberships":[],"dynGroups":[],"plainAttrs":[{"schema":"firstname","readonly":false,"values":[""]},{"schema":"userId","readonly":false,"values":["'test'"]},{"schema":"fullname","readonly":false,"values":["'test'"]},{"schema":"surname","readonly":false,"values":["'test'"]}]}'/>
<AnyTemplateSyncTask id="4" syncTask_id="24" anyType_name="GROUP"
- template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"propagationStatuses":[],"plainAttrs":[]}'/>
+ template='{"@class":"org.apache.syncope.common.lib.to.GroupTO","creator":null,"creationDate":null,"lastModifier":null,"lastChangeDate":null,"key":0,"type":"GROUP","realm":null,"status":null,"name":null,"userOwner":null,"groupOwner":null,"adynMembershipCond":null,"udynMembershipCond":null,"auxClasses":[],"derAttrs":[],"virAttrs":[],"resources":[],"plainAttrs":[]}'/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="25" name="CSV (unlink matching; ignore unmatching)" resource_name="resource-csv"
destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="1" fullReconciliation="0"
unmatchingRule="IGNORE" matchingRule="UNLINK"/>
@@ -1086,7 +1086,7 @@ under the License.
unmatchingRule="ASSIGN" matchingRule="IGNORE"/>
<Task DTYPE="PropagationTask" type="PROPAGATION" id="27" operation="CREATE"
objectClassName="__ACCOUNT__" resource_name="resource-testdb" anyTypeKind="USER" anyKey="1"
- xmlAttributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
+ attributes='[{"name":"__PASSWORD__","value":[{"readOnly":false,"disposed":false,"encryptedBytes":"m9nh2US0Sa6m+cXccCq0Xw==","base64SHA1Hash":"GFJ69qfjxEOdrmt+9q+0Cw2uz60="}]},{"name":"__NAME__","value":["userId"],"nameValue":"userId"},{"name":"fullname","value":["fullname"]},{"name":"type","value":["type"]}]'/>
<Task DTYPE="SyncTask" type="SYNCHRONIZATION" id="28" name="Scripted SQL" resource_name="resource-db-scripted"
destinationRealm_id="1" performCreate="1" performUpdate="1" performDelete="1" syncStatus="0" fullReconciliation="0"
unmatchingRule="PROVISION" matchingRule="UPDATE"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AnyObjectProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AnyObjectProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AnyObjectProvisioningManager.java
index d5571ab..df9a204 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AnyObjectProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/AnyObjectProvisioningManager.java
@@ -26,5 +26,5 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
public interface AnyObjectProvisioningManager extends ProvisioningManager<AnyObjectTO, AnyObjectPatch> {
- List<PropagationStatus> provision(Long key, Collection<String> resources);
+ List<PropagationStatus> provision(Long key, Collection<String> resources, boolean nullPriorityAsync);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
index ea258e5..3aae89f 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/GroupProvisioningManager.java
@@ -30,8 +30,8 @@ import org.apache.syncope.common.lib.to.GroupTO;
public interface GroupProvisioningManager extends ProvisioningManager<GroupTO, GroupPatch> {
Pair<Long, List<PropagationStatus>> create(
- GroupTO groupTO, Map<Long, String> groupOwnerMap, Set<String> excludedResources);
+ GroupTO groupTO, Map<Long, String> groupOwnerMap, Set<String> excludedResources, boolean nullPriorityAsync);
- List<PropagationStatus> provision(Long key, Collection<String> resources);
+ List<PropagationStatus> provision(Long key, Collection<String> resources, boolean nullPriorityAsync);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
index add5b03..72a1253 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/ProvisioningManager.java
@@ -28,22 +28,22 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
public interface ProvisioningManager<T extends AnyTO, P extends AnyPatch> {
- Pair<Long, List<PropagationStatus>> create(T anyTO);
+ Pair<Long, List<PropagationStatus>> create(T anyTO, boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> create(T anyTO, Set<String> excludedResources);
+ Pair<Long, List<PropagationStatus>> create(T anyTO, Set<String> excludedResources, boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> update(P anyMod);
+ Pair<Long, List<PropagationStatus>> update(P patch, boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> update(P anyMod, Set<String> excludedResources);
+ Pair<Long, List<PropagationStatus>> update(P patch, Set<String> excludedResources, boolean nullPriorityAsync);
- List<PropagationStatus> delete(Long anyKey);
+ List<PropagationStatus> delete(Long anyKey, boolean nullPriorityAsync);
- List<PropagationStatus> delete(Long anyKey, Set<String> excludedResources);
+ List<PropagationStatus> delete(Long anyKey, Set<String> excludedResources, boolean nullPriorityAsync);
Long unlink(P anyMod);
Long link(P anyMod);
- List<PropagationStatus> deprovision(Long anyKey, Collection<String> resources);
+ List<PropagationStatus> deprovision(Long anyKey, Collection<String> resources, boolean nullPriorityAsync);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
index b29eee3..1f9b7ef 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/UserProvisioningManager.java
@@ -26,30 +26,40 @@ import org.apache.syncope.common.lib.patch.StatusPatch;
import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
public interface UserProvisioningManager extends ProvisioningManager<UserTO, UserPatch> {
- Pair<Long, List<PropagationStatus>> activate(StatusPatch statusPatch);
+ Pair<Long, List<PropagationStatus>> activate(StatusPatch statusPatch, boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> reactivate(StatusPatch statusPatch);
+ Pair<Long, List<PropagationStatus>> reactivate(StatusPatch statusPatch, boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> suspend(StatusPatch statusPatch);
+ Pair<Long, List<PropagationStatus>> suspend(StatusPatch statusPatch, boolean nullPriorityAsync);
void internalSuspend(Long key);
- Pair<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword);
+ Pair<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword, boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> create(UserTO userTO, boolean storePassword,
- boolean disablePwdPolicyCheck, Boolean enabled, Set<String> excludedResources);
+ Pair<Long, List<PropagationStatus>> create(
+ UserTO userTO,
+ boolean storePassword,
+ boolean disablePwdPolicyCheck,
+ Boolean enabled,
+ Set<String> excludedResources,
+ boolean nullPriorityAsync);
- Pair<Long, List<PropagationStatus>> update(UserPatch userPatch, Long key,
- ProvisioningResult result, Boolean enabled, Set<String> excludedResources);
+ Pair<Long, List<PropagationStatus>> update(
+ UserPatch userPatch,
+ ProvisioningReport result,
+ Boolean enabled,
+ Set<String> excludedResources,
+ boolean nullPriorityAsync);
void requestPasswordReset(Long key);
void confirmPasswordReset(Long key, String token, String password);
- List<PropagationStatus> provision(Long key, boolean changePwd, String password, Collection<String> resources);
+ List<PropagationStatus> provision(
+ Long key, boolean changePwd, String password, Collection<String> resources, boolean nullPriorityAsync);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationReporter.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationReporter.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationReporter.java
index 20ae8df..d96b1a7 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationReporter.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationReporter.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.core.provisioning.api.propagation;
+import java.util.Collection;
import java.util.List;
import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
@@ -30,24 +31,29 @@ import org.identityconnectors.framework.common.objects.ConnectorObject;
public interface PropagationReporter {
/**
- * Report propagation status after executions in case of success or non-blocking failure
- * (e.g. on secondary resources).
+ * Report propagation status after executions in case blocking failure (e.g. on priority resources).
*
- * @param resourceName resource name.
- * @param execStatus propagation execution status.
- * @param failureReason propagation execution failure message.
- * @param beforeObj retrieved connector object before operation execution.
- * @param afterObj retrieved connector object after operation execution.
+ * @param failingResource failing resource name
+ * @param tasks propagation tasks performed before failure
*/
- void onSuccessOrSecondaryResourceFailures(String resourceName, PropagationTaskExecStatus execStatus,
- String failureReason, ConnectorObject beforeObj, ConnectorObject afterObj);
+ void onPriorityResourceFailure(String failingResource, Collection<PropagationTask> tasks);
/**
- * Report propagation status after executions in case blocking failure (e.g. on primary resources).
+ * Report propagation status after executions in case of success or non-blocking failure
+ * (e.g. on non-priority resources).
*
- * @param tasks propagation tasks performed before failure
+ * @param propagationTask propagation task
+ * @param execStatus propagation execution status
+ * @param failureReason propagation execution failure message
+ * @param beforeObj retrieved connector object before operation execution
+ * @param afterObj retrieved connector object after operation execution
*/
- void onPrimaryResourceFailure(List<PropagationTask> tasks);
+ void onSuccessOrNonPriorityResourceFailures(
+ PropagationTask propagationTask,
+ PropagationTaskExecStatus execStatus,
+ String failureReason,
+ ConnectorObject beforeObj,
+ ConnectorObject afterObj);
/**
* Returns the list of propagation statuses.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskCallable.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskCallable.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskCallable.java
new file mode 100644
index 0000000..84c4864
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskCallable.java
@@ -0,0 +1,32 @@
+/*
+ * 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.core.provisioning.api.propagation;
+
+import java.util.concurrent.Callable;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
+
+public interface PropagationTaskCallable extends Callable<TaskExec> {
+
+ void setExecutor(PropagationTaskExecutor executor);
+
+ void setTask(PropagationTask task);
+
+ void setReporter(PropagationReporter reporter);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskExecutor.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskExecutor.java
index d3b8870..ace29a2 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskExecutor.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/propagation/PropagationTaskExecutor.java
@@ -42,7 +42,18 @@ public interface PropagationTaskExecutor {
String MANDATORY_NULL_OR_EMPTY_ATTR_NAME = "__MANDATORY_NULL_OR_EMPTY__";
/**
- * Execute the given PropagationTask and returns the generated TaskExec.
+ * Creates new instances of {@link PropagationTaskCallable} for usage with
+ * {@link java.util.concurrent.CompletionService}.
+ *
+ * @param task to be executed
+ * @param reporter to report propagation execution status
+ * @return new {@link PropagationTaskCallable} instance for usage with
+ * {@link java.util.concurrent.CompletionService}
+ */
+ PropagationTaskCallable newPropagationTaskCallable(PropagationTask task, PropagationReporter reporter);
+
+ /**
+ * Execute the given PropagationTask and returns the generated {@link TaskExec}.
*
* @param task to be executed
* @return the generated TaskExec
@@ -67,11 +78,13 @@ public interface PropagationTaskExecutor {
void execute(Collection<PropagationTask> tasks);
/**
- * Execute a collection of PropagationTask objects and invoke the given handler on each of these.
- * The process is interrupted as soon as the result of the communication with a primary resource is in error.
+ * Execute a collection of PropagationTask objects.
+ * The process is interrupted as soon as the result of the communication with a resource with non-null priority is
+ * in error.
*
* @param tasks to be execute, in given order
* @param reporter to report propagation execution status
+ * @param nullPriorityAsync asynchronously executes tasks related to resources with no priority
*/
- void execute(Collection<PropagationTask> tasks, PropagationReporter reporter);
+ void execute(Collection<PropagationTask> tasks, PropagationReporter reporter, boolean nullPriorityAsync);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
index 6bab515..2e6e055 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningProfile.java
@@ -34,7 +34,7 @@ public class ProvisioningProfile<T extends ProvisioningTask, A extends Provision
private final T task;
- private final List<ProvisioningResult> results = new ArrayList<>();
+ private final List<ProvisioningReport> results = new ArrayList<>();
private boolean dryRun;
@@ -55,7 +55,7 @@ public class ProvisioningProfile<T extends ProvisioningTask, A extends Provision
return task;
}
- public Collection<ProvisioningResult> getResults() {
+ public Collection<ProvisioningReport> getResults() {
return results;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningReport.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningReport.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningReport.java
new file mode 100644
index 0000000..9e3c28a
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningReport.java
@@ -0,0 +1,140 @@
+/*
+ * 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.core.provisioning.api.sync;
+
+import java.util.Collection;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.common.lib.types.TraceLevel;
+
+public class ProvisioningReport {
+
+ public enum Status {
+
+ SUCCESS,
+ IGNORE,
+ FAILURE
+
+ }
+
+ private String message;
+
+ private Status status;
+
+ private String anyType;
+
+ private ResourceOperation operation;
+
+ private Long key;
+
+ private String name;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(final String message) {
+ this.message = message;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public Long getKey() {
+ return key;
+ }
+
+ public void setKey(final Long key) {
+ this.key = key;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(final Status status) {
+ this.status = status;
+ }
+
+ public String getAnyType() {
+ return anyType;
+ }
+
+ public void setAnyType(final String anyType) {
+ this.anyType = anyType;
+ }
+
+ public ResourceOperation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(final ResourceOperation operation) {
+ this.operation = operation;
+ }
+
+ @Override
+ public String toString() {
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
+ }
+
+ /**
+ * Human readable report string, using the given trace level.
+ *
+ * @param level trace level
+ * @return String for certain levels, null for level NONE
+ */
+ public String getReportString(final TraceLevel level) {
+ if (level == TraceLevel.SUMMARY) {
+ // No per entry log in this case.
+ return null;
+ } else if (level == TraceLevel.FAILURES && status == Status.FAILURE) {
+ // only report failures
+ return String.format("Failed %s (id/name): %d/%s with message: %s", operation, key, name, message);
+ } else {
+ // All
+ return String.format("%s %s (id/name): %d/%s %s", operation, status, key, name,
+ StringUtils.isBlank(message)
+ ? ""
+ : "with message: " + message);
+ }
+ }
+
+ /**
+ * Helper method to invoke logging per synchronization result for the given trace level.
+ *
+ * @param results synchronization result
+ * @param level trace level
+ * @return report as string
+ */
+ public static String produceReport(final Collection<ProvisioningReport> results, final TraceLevel level) {
+ StringBuilder sb = new StringBuilder();
+ for (ProvisioningReport result : results) {
+ sb.append(result.getReportString(level)).append('\n');
+ }
+ return sb.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
deleted file mode 100644
index 23af92d..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/ProvisioningResult.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.api.sync;
-
-import java.util.Collection;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.common.lib.types.TraceLevel;
-
-public class ProvisioningResult {
-
- public enum Status {
-
- SUCCESS,
- IGNORE,
- FAILURE
-
- }
-
- private String message;
-
- private Status status;
-
- private String anyType;
-
- private ResourceOperation operation;
-
- private Long key;
-
- private String name;
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(final String message) {
- this.message = message;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public Long getKey() {
- return key;
- }
-
- public void setKey(final Long key) {
- this.key = key;
- }
-
- public Status getStatus() {
- return status;
- }
-
- public void setStatus(final Status status) {
- this.status = status;
- }
-
- public String getAnyType() {
- return anyType;
- }
-
- public void setAnyType(final String anyType) {
- this.anyType = anyType;
- }
-
- public ResourceOperation getOperation() {
- return operation;
- }
-
- public void setOperation(final ResourceOperation operation) {
- this.operation = operation;
- }
-
- @Override
- public String toString() {
- return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
- }
-
- /**
- * Human readable report string, using the given trace level.
- *
- * @param level trace level
- * @return String for certain levels, null for level NONE
- */
- public String getReportString(final TraceLevel level) {
- if (level == TraceLevel.SUMMARY) {
- // No per entry log in this case.
- return null;
- } else if (level == TraceLevel.FAILURES && status == Status.FAILURE) {
- // only report failures
- return String.format("Failed %s (id/name): %d/%s with message: %s", operation, key, name, message);
- } else {
- // All
- return String.format("%s %s (id/name): %d/%s %s", operation, status, key, name,
- StringUtils.isBlank(message)
- ? ""
- : "with message: " + message);
- }
- }
-
- /**
- * Helper method to invoke logging per synchronization result for the given trace level.
- *
- * @param results synchronization result
- * @param level trace level
- * @return report as string
- */
- public static String produceReport(final Collection<ProvisioningResult> results, final TraceLevel level) {
- StringBuilder sb = new StringBuilder();
- for (ProvisioningResult result : results) {
- sb.append(result.getReportString(level)).append('\n');
- }
- return sb.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
index c06a05f..fee3a45 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/PushActions.java
@@ -145,7 +145,7 @@ public interface PushActions extends ProvisioningActions {
<A extends Any<?, ?>> void onError(
ProvisioningProfile<?, ?> profile,
A any,
- ProvisioningResult result,
+ ProvisioningReport result,
Exception error) throws JobExecutionException;
/**
@@ -160,5 +160,5 @@ public interface PushActions extends ProvisioningActions {
<A extends Any<?, ?>> void after(
ProvisioningProfile<?, ?> profile,
A any,
- ProvisioningResult result) throws JobExecutionException;
+ ProvisioningReport result) throws JobExecutionException;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
index fd36d39..e7c8d8c 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncActions.java
@@ -182,7 +182,7 @@ public interface SyncActions extends ProvisioningActions {
void onError(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
- ProvisioningResult result,
+ ProvisioningReport result,
Exception error) throws JobExecutionException;
/**
@@ -200,5 +200,5 @@ public interface SyncActions extends ProvisioningActions {
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
A any,
- ProvisioningResult result) throws JobExecutionException;
+ ProvisioningReport result) throws JobExecutionException;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
index ffecdb9..f2b489f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAnyObjectProvisioningManager.java
@@ -35,21 +35,16 @@ import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.AnyObjectProvisioningManager;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
import org.apache.syncope.core.workflow.api.AnyObjectWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisioningManager {
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectProvisioningManager.class);
-
@Autowired
protected AnyObjectWorkflowAdapter awfAdapter;
@@ -66,13 +61,13 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
protected AnyObjectDAO anyObjectDAO;
@Override
- public Pair<Long, List<PropagationStatus>> create(final AnyObjectTO anyObjectTO) {
- return create(anyObjectTO, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(final AnyObjectTO anyObjectTO, final boolean nullPriorityAsync) {
+ return create(anyObjectTO, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
public Pair<Long, List<PropagationStatus>> create(
- final AnyObjectTO anyObjectTO, final Set<String> excludedResources) {
+ final AnyObjectTO anyObjectTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
WorkflowResult<Long> created = awfAdapter.create(anyObjectTO);
@@ -84,24 +79,21 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(created.getResult(), propagationReporter.getStatuses());
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final AnyObjectPatch anyObjectPatch) {
- return update(anyObjectPatch, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> update(
+ final AnyObjectPatch anyObjectPatch, final boolean nullPriorityAsync) {
+
+ return update(anyObjectPatch, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
public Pair<Long, List<PropagationStatus>> update(
- final AnyObjectPatch anyObjectPatch, final Set<String> excludedResources) {
+ final AnyObjectPatch anyObjectPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
WorkflowResult<Long> updated = awfAdapter.update(anyObjectPatch);
@@ -115,23 +107,20 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses());
}
@Override
- public List<PropagationStatus> delete(final Long key) {
- return delete(key, Collections.<String>emptySet());
+ public List<PropagationStatus> delete(final Long key, final boolean nullPriorityAsync) {
+ return delete(key, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public List<PropagationStatus> delete(final Long key, final Set<String> excludedResources) {
+ public List<PropagationStatus> delete(
+ final Long key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
List<PropagationTask> tasks = propagationManager.getDeleteTasks(
AnyTypeKind.ANY_OBJECT,
key,
@@ -139,12 +128,7 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
awfAdapter.delete(key);
@@ -162,7 +146,9 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
}
@Override
- public List<PropagationStatus> provision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> provision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, resources);
@@ -176,17 +162,15 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
+
return propagationReporter.getStatuses();
}
@Override
- public List<PropagationStatus> deprovision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.DELETE, resources);
@@ -197,12 +181,8 @@ public class DefaultAnyObjectProvisioningManager implements AnyObjectProvisionin
CollectionUtils.removeAll(anyObjectDAO.findAllResourceNames(anyObjectDAO.authFind(key)), resources));
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
+
return propagationReporter.getStatuses();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
index 9e3d566..831e41f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultGroupProvisioningManager.java
@@ -25,8 +25,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import org.apache.commons.collections4.CollectionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -42,7 +40,6 @@ import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.GroupProvisioningManager;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
@@ -52,8 +49,6 @@ import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
public class DefaultGroupProvisioningManager implements GroupProvisioningManager {
- private static final Logger LOG = LoggerFactory.getLogger(GroupProvisioningManager.class);
-
@Autowired
protected GroupWorkflowAdapter gwfAdapter;
@@ -70,12 +65,14 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
protected VirAttrHandler virtAttrHandler;
@Override
- public Pair<Long, List<PropagationStatus>> create(final GroupTO group) {
- return create(group, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO group, final boolean nullPriorityAsync) {
+ return create(group, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(
+ final GroupTO groupTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
WorkflowResult<Long> created = gwfAdapter.create(groupTO);
List<PropagationTask> tasks = propagationManager.getCreateTasks(
@@ -86,19 +83,17 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(created.getResult(), propagationReporter.getStatuses());
}
@Override
public Pair<Long, List<PropagationStatus>> create(
- final GroupTO groupTO, final Map<Long, String> groupOwnerMap, final Set<String> excludedResources) {
+ final GroupTO groupTO,
+ final Map<Long, String> groupOwnerMap,
+ final Set<String> excludedResources,
+ final boolean nullPriorityAsync) {
WorkflowResult<Long> created = gwfAdapter.create(groupTO);
@@ -116,24 +111,19 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(created.getResult(), null);
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final GroupPatch groupPatch) {
- return update(groupPatch, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> update(final GroupPatch groupPatch, final boolean nullPriorityAsync) {
+ return update(groupPatch, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
public Pair<Long, List<PropagationStatus>> update(
- final GroupPatch groupPatch, final Set<String> excludedResources) {
+ final GroupPatch groupPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
WorkflowResult<Long> updated = gwfAdapter.update(groupPatch);
@@ -147,23 +137,20 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
return new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses());
}
@Override
- public List<PropagationStatus> delete(final Long key) {
- return delete(key, Collections.<String>emptySet());
+ public List<PropagationStatus> delete(final Long key, final boolean nullPriorityAsync) {
+ return delete(key, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public List<PropagationStatus> delete(final Long key, final Set<String> excludedResources) {
+ public List<PropagationStatus> delete(
+ final Long key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
List<PropagationTask> tasks = new ArrayList<>();
// Generate propagation tasks for deleting users and any objects from group resources,
@@ -196,12 +183,7 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
gwfAdapter.delete(key);
@@ -215,7 +197,9 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
}
@Override
- public List<PropagationStatus> provision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> provision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, resources);
@@ -229,17 +213,15 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
+
return propagationReporter.getStatuses();
}
@Override
- public List<PropagationStatus> deprovision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.DELETE, resources);
@@ -250,12 +232,8 @@ public class DefaultGroupProvisioningManager implements GroupProvisioningManager
CollectionUtils.removeAll(groupDAO.authFind(key).getResourceNames(), resources));
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
+
return propagationReporter.getStatuses();
}
[04/50] [abbrv] syncope git commit: [SYNCOPE-714] Consolidating old
buildSchemaNames and buildSupportedObjectClasses into new buildO
bjectClassInfo
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
index 2cc6476..39dbba9 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
@@ -35,8 +36,6 @@ import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PagedConnObjectTOResult;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
-import org.apache.syncope.common.lib.wrap.AnyKey;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.beans.ConnObjectTOListQuery;
import org.apache.syncope.common.rest.api.service.ResourceService;
@@ -134,41 +133,39 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
}
@Override
- public BulkActionResult bulkDeassociation(
- final String key, final String anyTypeKey, final ResourceDeassociationAction type,
- final List<AnyKey> keys) {
-
- AbstractResourceAssociator<? extends AnyTO> associator = anyTypeKey.equalsIgnoreCase(AnyTypeKind.USER.name())
- ? userLogic
- : anyTypeKey.equalsIgnoreCase(AnyTypeKind.GROUP.name())
- ? groupLogic
- : anyObjectLogic;
+ public BulkActionResult bulkDeassociation(final ResourceDeassociationPatch patch) {
+ AbstractResourceAssociator<? extends AnyTO> associator =
+ patch.getAnyTypeKey().equalsIgnoreCase(AnyTypeKind.USER.name())
+ ? userLogic
+ : patch.getAnyTypeKey().equalsIgnoreCase(AnyTypeKind.GROUP.name())
+ ? groupLogic
+ : anyObjectLogic;
BulkActionResult result = new BulkActionResult();
- for (AnyKey anyKey : keys) {
- Set<String> resources = Collections.singleton(key);
+ for (Long anyKey : patch.getAnyKyes()) {
+ Set<String> resources = Collections.singleton(patch.getKey());
try {
- switch (type) {
+ switch (patch.getAction()) {
case DEPROVISION:
- associator.deprovision(anyKey.getElement(), resources);
+ associator.deprovision(anyKey, resources);
break;
case UNASSIGN:
- associator.unassign(anyKey.getElement(), resources);
+ associator.unassign(anyKey, resources);
break;
case UNLINK:
- associator.unlink(anyKey.getElement(), resources);
+ associator.unlink(anyKey, resources);
break;
default:
}
- result.getResults().put(String.valueOf(anyKey.getElement()), BulkActionResult.Status.SUCCESS);
+ result.getResults().put(String.valueOf(anyKey), BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
- LOG.warn("While executing {} on {} {}", type, anyTypeKey, anyKey.getElement(), e);
- result.getResults().put(String.valueOf(anyKey.getElement()), BulkActionResult.Status.FAILURE);
+ LOG.warn("While executing {} on {} {}", patch.getAction(), patch.getAnyTypeKey(), anyKey, e);
+ result.getResults().put(String.valueOf(anyKey), BulkActionResult.Status.FAILURE);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index b30c962..60565e1 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -399,7 +399,7 @@ public abstract class AbstractITCase {
throws NamingException {
ResourceTO ldapRes = resourceService.read(RESOURCE_NAME_LDAP);
final Map<String, ConnConfProperty> ldapConnConf =
- connectorService.read(ldapRes.getConnector(), Locale.ENGLISH.getLanguage()).getConfigurationMap();
+ connectorService.read(ldapRes.getConnector(), Locale.ENGLISH.getLanguage()).getConfMap();
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
index 71859a7..770a7cb 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConnectorITCase.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
@@ -37,16 +38,18 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.ConnPoolConfTO;
import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -54,7 +57,6 @@ import org.apache.syncope.common.lib.types.ConnConfPropSchema;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.wrap.ConnIdObjectClass;
import org.apache.syncope.common.rest.api.service.ConnectorService;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.identityconnectors.common.security.GuardedString;
@@ -146,7 +148,7 @@ public class ConnectorITCase extends AbstractITCase {
conf.add(servicename);
// set connector configuration
- connectorTO.getConfiguration().addAll(conf);
+ connectorTO.getConf().addAll(conf);
// set connector capabilities
connectorTO.getCapabilities().add(ConnectorCapability.CREATE);
@@ -253,7 +255,7 @@ public class ConnectorITCase extends AbstractITCase {
conf.add(servicename);
// set connector configuration
- connectorTO.getConfiguration().addAll(conf);
+ connectorTO.getConf().addAll(conf);
connectorService.update(connectorTO);
ConnInstanceTO actual = connectorService.read(connectorTO.getKey(), Locale.ENGLISH.getLanguage());
@@ -397,7 +399,7 @@ public class ConnectorITCase extends AbstractITCase {
@Test
public void getConnectorConfiguration() {
- Set<ConnConfProperty> props = connectorService.read(104L, Locale.ENGLISH.getLanguage()).getConfiguration();
+ Set<ConnConfProperty> props = connectorService.read(104L, Locale.ENGLISH.getLanguage()).getConf();
assertNotNull(props);
assertFalse(props.isEmpty());
}
@@ -408,7 +410,7 @@ public class ConnectorITCase extends AbstractITCase {
boolean check = false;
- for (ConnConfProperty prop : connInstanceTO.getConfiguration()) {
+ for (ConnConfProperty prop : connInstanceTO.getConf()) {
if ("receiveTimeout".equals(prop.getSchema().getName())) {
check = true;
}
@@ -424,7 +426,7 @@ public class ConnectorITCase extends AbstractITCase {
Map<String, ConnConfProperty> instanceConfMap;
for (ConnInstanceTO instance : connectorInstanceTOs) {
if ("net.tirasa.connid.bundles.db.table".equals(instance.getBundleName())) {
- instanceConfMap = instance.getConfigurationMap();
+ instanceConfMap = instance.getConfMap();
assertEquals("Utente", instanceConfMap.get("user").getSchema().getDisplayName());
}
}
@@ -434,7 +436,7 @@ public class ConnectorITCase extends AbstractITCase {
for (ConnInstanceTO instance : connectorInstanceTOs) {
if ("net.tirasa.connid.bundles.db.table".equals(instance.getBundleName())) {
- instanceConfMap = instance.getConfigurationMap();
+ instanceConfMap = instance.getConfMap();
assertEquals("User", instanceConfMap.get("user").getSchema().getDisplayName());
}
}
@@ -516,7 +518,7 @@ public class ConnectorITCase extends AbstractITCase {
conf.add(passwordColumn);
// set connector configuration
- connectorTO.getConfiguration().addAll(conf);
+ connectorTO.getConf().addAll(conf);
try {
connectorService.check(connectorTO);
@@ -538,51 +540,35 @@ public class ConnectorITCase extends AbstractITCase {
}
@Test
- public void getSchemaNames() {
- ConnInstanceTO conn = connectorService.read(101L, Locale.ENGLISH.getLanguage());
-
- List<PlainSchemaTO> schemaNames = connectorService.buildSchemaNames(conn, true);
- assertNotNull(schemaNames);
- assertFalse(schemaNames.isEmpty());
- assertNotNull(schemaNames.get(0).getKey());
- assertNull(schemaNames.get(0).getEnumerationValues());
+ public void buildObjectClassInfo() {
+ ConnInstanceTO ws = connectorService.read(102L, Locale.ENGLISH.getLanguage());
+ assertNotNull(ws);
- schemaNames = connectorService.buildSchemaNames(conn, false);
+ List<ConnIdObjectClassTO> objectClassInfo = connectorService.buildObjectClassInfo(ws, true);
+ assertNotNull(objectClassInfo);
+ assertEquals(1, objectClassInfo.size());
+ assertEquals(ObjectClass.ACCOUNT_NAME, objectClassInfo.get(0).getType());
+ assertTrue(objectClassInfo.get(0).getAttributes().contains("promoThirdPartyDisclaimer"));
- assertNotNull(schemaNames);
- assertEquals(1, schemaNames.size());
+ ConnInstanceTO ldap = connectorService.read(105L, Locale.ENGLISH.getLanguage());
+ assertNotNull(ldap);
- conn = connectorService.read(104L, Locale.ENGLISH.getLanguage());
+ objectClassInfo = connectorService.buildObjectClassInfo(ldap, true);
+ assertNotNull(objectClassInfo);
+ assertEquals(2, objectClassInfo.size());
- // to be used with overridden properties
- conn.getConfiguration().clear();
+ Collection<String> objectClasses = CollectionUtils.collect(objectClassInfo,
+ new Transformer<ConnIdObjectClassTO, String>() {
- schemaNames = connectorService.buildSchemaNames(conn, true);
- assertNotNull(schemaNames);
- assertFalse(schemaNames.isEmpty());
- }
-
- @Test
- public void getSupportedObjectClasses() {
- ConnInstanceTO ldap = connectorService.read(105L, Locale.ENGLISH.getLanguage());
- assertNotNull(ldap);
+ @Override
+ public String transform(final ConnIdObjectClassTO info) {
+ return info.getType();
+ }
- List<ConnIdObjectClass> objectClasses = connectorService.buildSupportedObjectClasses(ldap);
- assertNotNull(objectClasses);
+ });
assertEquals(2, objectClasses.size());
- assertTrue(objectClasses.contains(
- ConnIdObjectClass.getInstance(ConnIdObjectClass.class, ObjectClass.ACCOUNT_NAME)));
- assertTrue(objectClasses.contains(
- ConnIdObjectClass.getInstance(ConnIdObjectClass.class, ObjectClass.GROUP_NAME)));
-
- ConnInstanceTO csv = connectorService.read(104L, Locale.ENGLISH.getLanguage());
- assertNotNull(csv);
-
- objectClasses = connectorService.buildSupportedObjectClasses(csv);
- assertNotNull(objectClasses);
- assertEquals(1, objectClasses.size());
- assertTrue(objectClasses.contains(
- ConnIdObjectClass.getInstance(ConnIdObjectClass.class, ObjectClass.ACCOUNT_NAME)));
+ assertTrue(objectClasses.contains(ObjectClass.ACCOUNT_NAME));
+ assertTrue(objectClasses.contains(ObjectClass.GROUP_NAME));
}
@Test
@@ -631,7 +617,7 @@ public class ConnectorITCase extends AbstractITCase {
conf.add(servicename);
// set connector configuration
- connectorTO.getConfiguration().addAll(conf);
+ connectorTO.getConf().addAll(conf);
try {
try {
@@ -664,7 +650,7 @@ public class ConnectorITCase extends AbstractITCase {
endpoint.getValues().add("http://localhost:9080/wssample/services/provisioning");
conf.add(endpoint);
- resourceTO.getConnConfProperties().addAll(conf);
+ resourceTO.getConfOverride().addAll(conf);
ProvisionTO provisionTO = new ProvisionTO();
provisionTO.setAnyType(AnyTypeKind.USER.name());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
index 928365f..236d169 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/LoggerITCase.java
@@ -38,7 +38,7 @@ import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.LoggerLevel;
import org.apache.syncope.common.lib.types.LoggerType;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
+import org.apache.syncope.common.rest.api.LoggerWrapper;
import org.apache.syncope.core.logic.ReportLogic;
import org.apache.syncope.core.logic.ResourceLogic;
import org.apache.syncope.core.logic.GroupLogic;
@@ -105,7 +105,7 @@ public class LoggerITCase extends AbstractITCase {
"deleteExecution",
AuditElements.Result.FAILURE);
- List<AuditLoggerName> audits = CollectionWrapper.wrapLogger(loggerService.list(LoggerType.AUDIT));
+ List<AuditLoggerName> audits = LoggerWrapper.wrap(loggerService.list(LoggerType.AUDIT));
assertNotNull(audits);
assertFalse(audits.contains(auditLoggerName));
@@ -114,13 +114,13 @@ public class LoggerITCase extends AbstractITCase {
loggerTO.setLevel(LoggerLevel.DEBUG);
loggerService.update(LoggerType.AUDIT, loggerTO);
- audits = CollectionWrapper.wrapLogger(loggerService.list(LoggerType.AUDIT));
+ audits = LoggerWrapper.wrap(loggerService.list(LoggerType.AUDIT));
assertNotNull(audits);
assertTrue(audits.contains(auditLoggerName));
loggerService.delete(LoggerType.AUDIT, auditLoggerName.toLoggerName());
- audits = CollectionWrapper.wrapLogger(loggerService.list(LoggerType.AUDIT));
+ audits = LoggerWrapper.wrap(loggerService.list(LoggerType.AUDIT));
assertNotNull(audits);
assertFalse(audits.contains(auditLoggerName));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
index e0539c8..5d4d176 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
@@ -170,7 +170,7 @@ public class ResourceITCase extends AbstractITCase {
p.getValues().add("http://invalidurl/");
Set<ConnConfProperty> connectorConfigurationProperties = new HashSet<>(Arrays.asList(p));
- resourceTO.getConnConfProperties().addAll(connectorConfigurationProperties);
+ resourceTO.getConfOverride().addAll(connectorConfigurationProperties);
Response response = resourceService.create(resourceTO);
ResourceTO actual = getObject(response.getLocation(), ResourceService.class, ResourceTO.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
index e8ffd56..ef73242 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
@@ -748,7 +748,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
ResourceTO ldapResource = resourceService.read(RESOURCE_NAME_LDAP);
ConnInstanceTO resourceConnector = connectorService.read(
ldapResource.getConnector(), Locale.ENGLISH.getLanguage());
- ConnConfProperty property = resourceConnector.getConfigurationMap().get("retrievePasswordsWithSearch");
+ ConnConfProperty property = resourceConnector.getConfMap().get("retrievePasswordsWithSearch");
property.getValues().clear();
property.getValues().add(Boolean.TRUE);
connectorService.update(resourceConnector);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
index e96026f..cf00ffd 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
@@ -367,7 +367,7 @@ public class VirAttrITCase extends AbstractITCase {
String jdbcURL = null;
ConnInstanceTO connInstanceTO = connectorService.readByResource(
RESOURCE_NAME_DBVIRATTR, Locale.ENGLISH.getLanguage());
- for (ConnConfProperty prop : connInstanceTO.getConfiguration()) {
+ for (ConnConfProperty prop : connInstanceTO.getConf()) {
if ("jdbcUrlTemplate".equals(prop.getSchema().getName())) {
jdbcURL = prop.getValues().iterator().next().toString();
prop.getValues().clear();
@@ -400,7 +400,7 @@ public class VirAttrITCase extends AbstractITCase {
// ----------------------------------------
// 5. restore connector URL, values can be read again from external resource
// ----------------------------------------
- for (ConnConfProperty prop : connInstanceTO.getConfiguration()) {
+ for (ConnConfProperty prop : connInstanceTO.getConf()) {
if ("jdbcUrlTemplate".equals(prop.getSchema().getName())) {
prop.getValues().clear();
prop.getValues().add(jdbcURL);
[50/50] [abbrv] syncope git commit: Merge branch 'master' into
SYNCOPE-156
Posted by fm...@apache.org.
Merge branch 'master' into SYNCOPE-156
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e9bf6d17
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e9bf6d17
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e9bf6d17
Branch: refs/heads/SYNCOPE-156
Commit: e9bf6d17fc3d17a24b69b23dd398a53df27c4f4e
Parents: 047ac01 1a05fe1
Author: fmartelli <fa...@gmail.com>
Authored: Fri Oct 30 12:33:45 2015 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Oct 30 12:33:45 2015 +0100
----------------------------------------------------------------------
src/site/xdoc/source-repository.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[25/50] [abbrv] syncope git commit: message refactoring, SYNCOPE-158
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListRunningJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListRunningJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListRunningJobs.java
new file mode 100644
index 0000000..931cfef
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListRunningJobs.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cli.commands.task;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class TaskListRunningJobs extends AbstractTaskCommand {
+
+ private static final String READ_HELP_MESSAGE = "task --list-running-jobs";
+
+ private final Input input;
+
+ public TaskListRunningJobs(final Input input) {
+ this.input = input;
+ }
+
+ public void list() {
+ if (input.parameterNumber() == 0) {
+ try {
+ taskResultManager.printTaskExecTO(taskSyncopeOperations.listRunningJobs());
+ } catch (final SyncopeClientException ex) {
+ taskResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ taskResultManager.unnecessaryParameters(input.listParameters(), READ_HELP_MESSAGE);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListScheduledJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListScheduledJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListScheduledJobs.java
new file mode 100644
index 0000000..ec2cab1
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskListScheduledJobs.java
@@ -0,0 +1,45 @@
+/*
+ * 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.cli.commands.task;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class TaskListScheduledJobs extends AbstractTaskCommand {
+
+ private static final String READ_HELP_MESSAGE = "task --list-scheduled-jobs";
+
+ private final Input input;
+
+ public TaskListScheduledJobs(final Input input) {
+ this.input = input;
+ }
+
+ public void list() {
+ if (input.parameterNumber() == 0) {
+ try {
+ taskResultManager.printTaskExecTO(taskSyncopeOperations.listScheduledJobs());
+ } catch (final SyncopeClientException ex) {
+ taskResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ taskResultManager.unnecessaryParameters(input.listParameters(), READ_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
index 9e93d9e..7b9b5d5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
@@ -46,7 +46,7 @@ public class TaskRead extends AbstractTaskCommand {
if (ex.getMessage().startsWith("NotFound")) {
taskResultManager.notFoundError("Task", parameter);
} else {
- taskResultManager.generic("Error: " + ex.getMessage());
+ taskResultManager.genericError(ex.getMessage());
}
break;
}
@@ -56,5 +56,4 @@ public class TaskRead extends AbstractTaskCommand {
taskResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
deleted file mode 100644
index d3a7e93..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.task;
-
-import org.apache.syncope.common.lib.SyncopeClientException;
-
-public class TaskRunningJobs extends AbstractTaskCommand {
-
- public void list() {
- try {
- taskResultManager.printTaskExecTO(taskSyncopeOperations.listRunningJobs());
- } catch (final SyncopeClientException ex) {
- taskResultManager.generic(ex.getMessage());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
deleted file mode 100644
index c4798d5..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.task;
-
-import org.apache.syncope.common.lib.SyncopeClientException;
-
-public class TaskScheduledJobs extends AbstractTaskCommand {
-
- public void list() {
- try {
- taskResultManager.printTaskExecTO(taskSyncopeOperations.listScheduledJobs());
- } catch (final SyncopeClientException ex) {
- taskResultManager.generic(ex.getMessage());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
index 35c3941..f34d1d0 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
@@ -59,7 +59,7 @@ public class UserCommand extends AbstractCommand {
new UserCount(input).count();
break;
case LIST:
- new UserList().list();
+ new UserList(input).list();
break;
case GET_BY_KEY:
new UserGetKey(input).get();
@@ -140,5 +140,4 @@ public class UserCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
index a9cff9e..7316768 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
@@ -23,6 +23,8 @@ import org.apache.syncope.common.lib.SyncopeClientException;
public class UserCount extends AbstractUserCommand {
+ private static final String COUNT_HELP_MESSAGE = "user --count";
+
private final Input input;
public UserCount(final Input input) {
@@ -32,12 +34,12 @@ public class UserCount extends AbstractUserCommand {
public void count() {
if (input.parameterNumber() == 0) {
try {
- userResultManager.generic("Total users: " + userSyncopeOperations.count());
+ userResultManager.genericMessage("Total users: " + userSyncopeOperations.count());
} catch (final SyncopeClientException ex) {
- userResultManager.generic("Error: " + ex.getMessage());
+ userResultManager.genericError(ex.getMessage());
}
} else {
- userResultManager.generic("Error: unnecessary parameters " + input.listParameters());
+ userResultManager.unnecessaryParameters(input.listParameters(), COUNT_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
index 817db6c..80195f8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
@@ -42,7 +42,7 @@ public class UserDelete extends AbstractUserCommand {
if (ex.getMessage().startsWith("NotFound")) {
userResultManager.notFoundError("User", parameter);
} else {
- userResultManager.generic(ex.getMessage());
+ userResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
userResultManager.numberFormatException("user", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
index d64a327..d11c9c8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
@@ -34,9 +34,9 @@ public class UserGetKey extends AbstractUserCommand {
public void get() {
if (input.getParameters().length == 1) {
try {
- userResultManager.generic(userSyncopeOperations.getIdFromUsername(input.firstParameter()));
+ userResultManager.genericMessage(userSyncopeOperations.getIdFromUsername(input.firstParameter()));
} catch (final SyncopeClientException ex) {
- userResultManager.generic("Error: " + ex.getMessage());
+ userResultManager.genericError(ex.getMessage());
}
} else {
userResultManager.commandOptionError(GET_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
index a94b1df..6686663 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
@@ -34,9 +34,9 @@ public class UserGetUsername extends AbstractUserCommand {
public void get() {
if (input.getParameters().length == 1) {
try {
- userResultManager.generic(userSyncopeOperations.getUsernameFromId(input.firstParameter()));
+ userResultManager.genericMessage(userSyncopeOperations.getUsernameFromId(input.firstParameter()));
} catch (final SyncopeClientException ex) {
- userResultManager.generic("Error: " + ex.getMessage());
+ userResultManager.genericError(ex.getMessage());
}
} else {
userResultManager.commandOptionError(GET_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
index 4778cd2..94dad59 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
@@ -20,29 +20,42 @@ package org.apache.syncope.client.cli.commands.user;
import java.util.LinkedList;
import java.util.Scanner;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.UserTO;
public class UserList extends AbstractUserCommand {
+ private static final String LIST_HELP_MESSAGE = "user --list";
+
+ private final Input input;
+
+ public UserList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- final Scanner scanIn = new Scanner(System.in);
- System.out.println(
- "This operation could be print a lot of information "
- + "on your screen. Do you want to continue? [yes/no]");
- final String answer = scanIn.nextLine();
- if ("yes".equalsIgnoreCase(answer)) {
- final PagedResult<UserTO> uResult = userSyncopeOperations.list();
- userResultManager.toView(new LinkedList<>(uResult.getResult()));
- } else if ("no".equalsIgnoreCase(answer)) {
- userResultManager.generic("List operation skipped");
- } else {
- userResultManager.generic("Invalid parameter, please use [yes/no]");
+ if (input.parameterNumber() == 0) {
+ try {
+ final Scanner scanIn = new Scanner(System.in);
+ System.out.println(
+ "This operation could be print a lot of information "
+ + "on your screen. Do you want to continue? [yes/no]");
+ final String answer = scanIn.nextLine();
+ if ("yes".equalsIgnoreCase(answer)) {
+ final PagedResult<UserTO> uResult = userSyncopeOperations.list();
+ userResultManager.toView(new LinkedList<>(uResult.getResult()));
+ } else if ("no".equalsIgnoreCase(answer)) {
+ userResultManager.genericError("List operation skipped");
+ } else {
+ userResultManager.genericError("Invalid parameter, please use [yes/no]");
+ }
+ } catch (final SyncopeClientException ex) {
+ userResultManager.genericError(ex.getMessage());
}
- } catch (final SyncopeClientException ex) {
- userResultManager.generic(ex.getMessage());
+ } else {
+ userResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
index 8fd9144..39dcb23 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
@@ -45,7 +45,7 @@ public class UserRead extends AbstractUserCommand {
if (ex.getMessage().startsWith("NotFound")) {
userResultManager.notFoundError("User", parameter);
} else {
- userResultManager.generic("Error: " + ex.getMessage());
+ userResultManager.genericError(ex.getMessage());
}
break;
} catch (final NumberFormatException ex) {
@@ -57,5 +57,4 @@ public class UserRead extends AbstractUserCommand {
userResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
index 2ea0578..900d32c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
@@ -32,7 +32,6 @@ public class UserResultManager extends CommonsResultManager {
for (final UserTO userTO : userTOs) {
printUser(userTO);
}
- System.out.println("");
}
private void printUser(final UserTO userTO) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
index 18ac77e..a00812f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
@@ -43,12 +43,13 @@ public class UserSearchByAttribute extends AbstractUserCommand {
try {
List<UserTO> userTOs;
if (!realmSyncopeOperations.exists(realm)) {
- userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+ userResultManager.genericMessage("Operation performed on root realm because " + realm
+ + "does not exists");
}
userTOs = userSyncopeOperations.searchByAttribute(
realm, pairParameter.getKey(), pairParameter.getValue());
if (userTOs == null || userTOs.isEmpty()) {
- userResultManager.generic("No users found with attribute "
+ userResultManager.genericMessage("No users found with attribute "
+ pairParameter.getKey() + " and value " + pairParameter.getValue());
} else {
userResultManager.toView(userTOs);
@@ -57,13 +58,13 @@ public class UserSearchByAttribute extends AbstractUserCommand {
if (ex.getMessage().startsWith("NotFound")) {
userResultManager.notFoundError("User with " + pairParameter.getKey(), pairParameter.getValue());
} else {
- userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ userResultManager.genericError(ex.getMessage());
}
} catch (final IllegalArgumentException ex) {
- userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ userResultManager.genericError(ex.getMessage());
+ userResultManager.genericError(SEARCH_HELP_MESSAGE);
}
userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
index 6a22150..5d6177c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
@@ -45,7 +45,8 @@ public class UserSearchByResource extends AbstractUserCommand {
try {
List<UserTO> userTOs = null;
if (!realmSyncopeOperations.exists(realm)) {
- userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+ userResultManager.genericMessage("Operation performed on root realm because " + realm
+ + "does not exists");
}
if (!resourceSyncopeOperations.exists(resource)) {
userResultManager.notFoundError("Resource", resource);
@@ -53,16 +54,16 @@ public class UserSearchByResource extends AbstractUserCommand {
userTOs = userSyncopeOperations.searchByResource(realm, resource);
}
if (userTOs == null || userTOs.isEmpty()) {
- userResultManager.generic("No users has " + resource + " assigned");
+ userResultManager.genericMessage("No users has " + resource + " assigned");
} else {
userResultManager.toView(userTOs);
}
} catch (final WebServiceException | SyncopeClientException ex) {
- userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ userResultManager.genericError(ex.getMessage());
+ userResultManager.genericError(SEARCH_HELP_MESSAGE);
}
} else {
userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
index 789bacb..6e041fe 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
@@ -43,20 +43,21 @@ public class UserSearchByRole extends AbstractUserCommand {
try {
List<UserTO> userTOs;
if (!realmSyncopeOperations.exists(realm)) {
- userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+ userResultManager.genericMessage("Operation performed on root realm because "
+ + realm + "does not exists");
}
userTOs = userSyncopeOperations.searchByRole(realm, input.secondParameter());
if (userTOs == null || userTOs.isEmpty()) {
- userResultManager.generic("No users has " + role + " assigned");
+ userResultManager.genericMessage("No users has " + role + " assigned");
} else {
userResultManager.toView(userTOs);
}
} catch (final WebServiceException | SyncopeClientException ex) {
- userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ userResultManager.genericError(ex.getMessage());
+ userResultManager.genericError(SEARCH_HELP_MESSAGE);
}
} else {
userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/util/CommandUtils.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/util/CommandUtils.java b/client/cli/src/main/java/org/apache/syncope/client/cli/util/CommandUtils.java
index b759877..c1c2182 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/util/CommandUtils.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/util/CommandUtils.java
@@ -88,5 +88,4 @@ public final class CommandUtils {
private CommandUtils() {
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/util/FileSystemUtils.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/util/FileSystemUtils.java b/client/cli/src/main/java/org/apache/syncope/client/cli/util/FileSystemUtils.java
index 355e69c..aed3bd5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/util/FileSystemUtils.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/util/FileSystemUtils.java
@@ -41,8 +41,13 @@ public final class FileSystemUtils {
final File installationDirectory = new File(path);
return installationDirectory.canWrite();
}
-
+
+ public static boolean exists(final String path) {
+ final File installationDirectory = new File(path);
+ return installationDirectory.exists();
+ }
+
private FileSystemUtils() {
-
+
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/util/JasyptUtils.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/util/JasyptUtils.java b/client/cli/src/main/java/org/apache/syncope/client/cli/util/JasyptUtils.java
index 4e4551c..c0af3b0 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/util/JasyptUtils.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/util/JasyptUtils.java
@@ -45,5 +45,4 @@ public final class JasyptUtils {
public String decrypt(final String encryptedString) {
return textEncryptor.decrypt(encryptedString);
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Messages.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/view/Messages.java b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Messages.java
index 4489b9b..c062524 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/view/Messages.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Messages.java
@@ -18,6 +18,8 @@
*/
package org.apache.syncope.client.cli.view;
+import java.util.List;
+
public final class Messages {
private static final String OPTION_COMMAND_MESSAGE_TEMPLATE = "\n - Usage: %s\n";
@@ -87,7 +89,10 @@ public final class Messages {
public static void printDefaultMessage(final String option, final String helpMessage) {
printMessage(String.format(DEFAULT_MESSAGE_TEMPLATE, option, helpMessage));
}
-
+
+ public static void printUnnecessaryParameters(final List<String> parameters, final String helpMessage) {
+ printMessage("Unnecessary parameter: " + parameters, "Usage: " + helpMessage);
+ }
private Messages() {
}
[36/50] [abbrv] syncope git commit: [SYNCOPE-717] Fix
AjaxDoubleFieldPanel
Posted by fm...@apache.org.
[SYNCOPE-717] Fix AjaxDoubleFieldPanel
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/381dfde3
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/381dfde3
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/381dfde3
Branch: refs/heads/SYNCOPE-156
Commit: 381dfde35a27c1d1447ad40941ddabf4dbf9268c
Parents: d404b40
Author: Marco Di Sabatino Di Diodoro <md...@apache.org>
Authored: Fri Oct 30 10:04:42 2015 +0100
Committer: Marco Di Sabatino Di Diodoro <md...@apache.org>
Committed: Fri Oct 30 10:04:42 2015 +0100
----------------------------------------------------------------------
.../console/wicket/markup/html/form/AjaxDoubleFieldPanel.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/381dfde3/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
index a5f8129..b548167 100644
--- a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
@@ -130,7 +130,7 @@ public class AjaxDoubleFieldPanel extends FieldPanel<Double> {
public Double getObject() {
Double value = null;
- if (list != null && !list.isEmpty()) {
+ if (list != null && !list.isEmpty() && StringUtils.isNotEmpty(list.get(0).toString())) {
try {
value = englishDf.parse(list.get(0).toString()).doubleValue();
} catch (ParseException e) {
[46/50] [abbrv] syncope git commit: Merge from master
Posted by fm...@apache.org.
Merge from master
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1a05fe19
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1a05fe19
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1a05fe19
Branch: refs/heads/SYNCOPE-156
Commit: 1a05fe1959833f9e7de09b0f133b52c00dab5f8d
Parents: d43268c 214a374
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 30 12:08:05 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 30 12:08:05 2015 +0100
----------------------------------------------------------------------
src/site/xdoc/source-repository.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[10/50] [abbrv] syncope git commit: [SYNCOPE-716] Fixed
Posted by fm...@apache.org.
[SYNCOPE-716] Fixed
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/893d8890
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/893d8890
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/893d8890
Branch: refs/heads/SYNCOPE-156
Commit: 893d88901513100e3daf5d4d5b4b47a3f72f9aea
Parents: d2f57ab
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Oct 27 10:09:15 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Oct 27 10:09:15 2015 +0100
----------------------------------------------------------------------
.../main/java/org/apache/syncope/console/pages/SchemaModalPage.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/893d8890/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
index 1e634f0..a0415ac 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
@@ -169,6 +169,7 @@ public class SchemaModalPage extends AbstractSchemaModalPage<SchemaTO> {
enumParams, enumerationValuesPanel, enumerationValues, enumerationKeys,
encryptedParams, secretKey, cipherAlgorithm,
binaryParams, mimeType);
+ target.add(conversionParams);
target.add(typeParams);
}
});
[14/50] [abbrv] syncope git commit: Fixed SYNCOPE-589
Posted by fm...@apache.org.
Fixed SYNCOPE-589
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/74e867e8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/74e867e8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/74e867e8
Branch: refs/heads/SYNCOPE-156
Commit: 74e867e8ccde9d184b7986b8329907ef51e4372b
Parents: 47b9f64
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 28 10:27:58 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 28 10:27:58 2015 +0100
----------------------------------------------------------------------
.../cli/commands/role/AbstractRoleCommand.java | 27 +++++
.../client/cli/commands/role/RoleCommand.java | 109 +++++++++++++++++++
.../client/cli/commands/role/RoleDelete.java | 57 ++++++++++
.../client/cli/commands/role/RoleList.java | 32 ++++++
.../client/cli/commands/role/RoleRead.java | 61 +++++++++++
.../cli/commands/role/RoleResultManager.java | 57 ++++++++++
.../commands/role/RoleSyncopeOperations.java | 42 +++++++
.../client/cli/commands/user/UserRead.java | 7 +-
8 files changed, 389 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
new file mode 100644
index 0000000..b4709a0
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
@@ -0,0 +1,27 @@
+/*
+ * 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.cli.commands.role;
+
+public class AbstractRoleCommand {
+
+ protected RoleSyncopeOperations roleSyncopeOperations = new RoleSyncopeOperations();
+
+ protected RoleResultManager roleResultManager = new RoleResultManager();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
new file mode 100644
index 0000000..bb2f988
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
@@ -0,0 +1,109 @@
+/*
+ * 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.cli.commands.role;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "role")
+public class RoleCommand extends AbstractCommand {
+
+ private static final String HELP_MESSAGE = "Usage: role [options]\n"
+ + " Options:\n"
+ + " --help \n"
+ + " --list \n"
+ + " --read \n"
+ + " Syntax: --read {ROLE-ID} {ROLE-ID} [...]"
+ + " --delete \n"
+ + " Syntax: --delete {ROLE-ID} {ROLE-ID} [...]";
+
+ @Override
+ public void execute(final Input input) {
+ if (StringUtils.isBlank(input.getOption())) {
+ input.setOption(RoleOptions.HELP.getOptionName());
+ }
+
+ switch (RoleOptions.fromName(input.getOption())) {
+ case LIST:
+ new RoleList().list();
+ break;
+ case READ:
+ new RoleRead(input).read();
+ break;
+ case DELETE:
+ new RoleDelete(input).delete();
+ break;
+ case HELP:
+ System.out.println(HELP_MESSAGE);
+ break;
+ default:
+ new RoleResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+ }
+ }
+
+ @Override
+ public String getHelpMessage() {
+ return HELP_MESSAGE;
+ }
+
+ private enum RoleOptions {
+
+ HELP("--help"),
+ LIST("--list"),
+ READ("--read"),
+ DELETE("--delete");
+
+ private final String optionName;
+
+ RoleOptions(final String optionName) {
+ this.optionName = optionName;
+ }
+
+ public String getOptionName() {
+ return optionName;
+ }
+
+ public boolean equalsOptionName(final String otherName) {
+ return (otherName == null) ? false : optionName.equals(otherName);
+ }
+
+ public static RoleOptions fromName(final String name) {
+ RoleOptions optionToReturn = HELP;
+ for (final RoleOptions option : RoleOptions.values()) {
+ if (option.equalsOptionName(name)) {
+ optionToReturn = option;
+ }
+ }
+ return optionToReturn;
+ }
+
+ public static List<String> toList() {
+ final List<String> options = new ArrayList<>();
+ for (final RoleOptions value : values()) {
+ options.add(value.getOptionName());
+ }
+ return options;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
new file mode 100644
index 0000000..50ac248
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
@@ -0,0 +1,57 @@
+/*
+ * 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.cli.commands.role;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class RoleDelete extends AbstractRoleCommand {
+
+ private static final String DELETE_HELP_MESSAGE = "role --delete {ROLE-ID} {ROLE-ID} [...]";
+
+ private final Input input;
+
+ public RoleDelete(final Input input) {
+ this.input = input;
+ }
+
+ public void delete() {
+ if (input.getParameters().length >= 1) {
+ for (final String parameter : input.getParameters()) {
+ try {
+ roleSyncopeOperations.delete(parameter);
+ roleResultManager.deletedMessage("role", parameter);
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ roleResultManager.notFoundError("Role", parameter);
+ } else {
+ roleResultManager.generic("Error: " + ex.getMessage());
+ }
+ break;
+ } catch (final NumberFormatException ex) {
+ roleResultManager.numberFormatException("user", parameter);
+ }
+ }
+ } else {
+ roleResultManager.commandOptionError(DELETE_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
new file mode 100644
index 0000000..e87b1c2
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
@@ -0,0 +1,32 @@
+/*
+ * 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.cli.commands.role;
+
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class RoleList extends AbstractRoleCommand {
+
+ public void list() {
+ try {
+ roleResultManager.toView(roleSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ roleResultManager.generic(ex.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
new file mode 100644
index 0000000..2a0393f
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
@@ -0,0 +1,61 @@
+/*
+ * 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.cli.commands.role;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.RoleTO;
+
+public class RoleRead extends AbstractRoleCommand {
+
+ private static final String READ_HELP_MESSAGE = "role --read {ROLE-ID} {ROLE-ID} [...]";
+
+ private final Input input;
+
+ public RoleRead(final Input input) {
+ this.input = input;
+ }
+
+ public void read() {
+ if (input.getParameters().length >= 1) {
+ final List<RoleTO> roleTOs = new ArrayList<>();
+ for (final String parameter : input.getParameters()) {
+ try {
+ roleTOs.add(roleSyncopeOperations.read(parameter));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ roleResultManager.notFoundError("Role", parameter);
+ } else {
+ roleResultManager.generic("Error: " + ex.getMessage());
+ }
+ break;
+ } catch (final NumberFormatException ex) {
+ roleResultManager.numberFormatException("user", parameter);
+ }
+ }
+ roleResultManager.toView(roleTOs);
+ } else {
+ roleResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
new file mode 100644
index 0000000..a672d53
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleResultManager.java
@@ -0,0 +1,57 @@
+/*
+ * 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.cli.commands.role;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.RoleTO;
+
+public class RoleResultManager extends CommonsResultManager {
+
+ public void toView(final List<RoleTO> roleTOs) {
+ for (final RoleTO roleTO : roleTOs) {
+ printRole(roleTO);
+ }
+ System.out.println("");
+ }
+
+ private void printRole(final RoleTO roleTO) {
+ System.out.println(" > ROLE ID: " + roleTO.getKey());
+ System.out.println(" name: " + roleTO.getName());
+ System.out.println(" REALMS: ");
+ printRealms(roleTO.getRealms());
+ System.out.println(" ENTITLEMENTS:");
+ printEntitlements(roleTO.getEntitlements());
+ System.out.println(" dynamic membership condition: " + roleTO.getDynMembershipCond());
+ System.out.println("");
+ }
+
+ private void printRealms(final List<String> realms) {
+ for (final String realm : realms) {
+ System.out.println(" - " + realm);
+ }
+ }
+
+ private void printEntitlements(final Set<String> entitlements) {
+ for (final String entitlement : entitlements) {
+ System.out.println(" - " + entitlement);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
new file mode 100644
index 0000000..c24c3e9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
@@ -0,0 +1,42 @@
+/*
+ * 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.cli.commands.role;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.rest.api.service.RoleService;
+
+public class RoleSyncopeOperations {
+
+ private final RoleService roleService = SyncopeServices.get(RoleService.class);
+
+ public List<RoleTO> list() {
+ return roleService.list();
+ }
+
+ public RoleTO read(final String roleId) {
+ return roleService.read(Long.valueOf(roleId));
+ }
+
+ public void delete(final String roleId) {
+ roleService.delete(Long.valueOf(roleId));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/74e867e8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
index ae94409..8fd9144 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
@@ -18,7 +18,8 @@
*/
package org.apache.syncope.client.cli.commands.user;
-import java.util.LinkedList;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
@@ -36,13 +37,13 @@ public class UserRead extends AbstractUserCommand {
public void read() {
if (input.getParameters().length >= 1) {
- final LinkedList<UserTO> userTOs = new LinkedList<>();
+ final List<UserTO> userTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
userTOs.add(userSyncopeOperations.read(parameter));
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
- userResultManager.notFoundError("Logger", parameter);
+ userResultManager.notFoundError("User", parameter);
} else {
userResultManager.generic("Error: " + ex.getMessage());
}
[22/50] [abbrv] syncope git commit: [SYNCOPE-141] Preliminary changes
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ConnObjectUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ConnObjectUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ConnObjectUtils.java
new file mode 100644
index 0000000..97bf8d8
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ConnObjectUtils.java
@@ -0,0 +1,259 @@
+/*
+ * 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.core.misc.utils;
+
+import org.apache.syncope.core.misc.policy.InvalidPasswordRuleConf;
+import org.apache.syncope.core.misc.security.SecureRandomUtils;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.AnyOperations;
+import org.apache.syncope.common.lib.patch.AnyPatch;
+import org.apache.syncope.common.lib.policy.PasswordRuleConf;
+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.ConnObjectTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.entity.AnyUtils;
+import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.misc.security.Encryptor;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
+import org.apache.syncope.core.persistence.api.dao.RealmDAO;
+import org.apache.syncope.core.persistence.api.entity.Realm;
+import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.GuardedByteArray;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+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;
+
+@Component
+public class ConnObjectUtils {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ConnObjectUtils.class);
+
+ private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
+
+ @Autowired
+ private TemplateUtils templateUtils;
+
+ @Autowired
+ private RealmDAO realmDAO;
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private ExternalResourceDAO resourceDAO;
+
+ @Autowired
+ private PasswordGenerator passwordGenerator;
+
+ @Autowired
+ private MappingUtils mappingUtils;
+
+ /**
+ * Extract password value from passed value (if instance of GuardedString or GuardedByteArray).
+ *
+ * @param pwd received from the underlying connector
+ * @return password value
+ */
+ public static String getPassword(final Object pwd) {
+ final StringBuilder result = new StringBuilder();
+
+ if (pwd instanceof GuardedString) {
+ ((GuardedString) pwd).access(new GuardedString.Accessor() {
+
+ @Override
+ public void access(final char[] clearChars) {
+ result.append(clearChars);
+ }
+ });
+ } else if (pwd instanceof GuardedByteArray) {
+ ((GuardedByteArray) pwd).access(new GuardedByteArray.Accessor() {
+
+ @Override
+ public void access(final byte[] clearBytes) {
+ result.append(new String(clearBytes));
+ }
+ });
+ } else if (pwd instanceof String) {
+ result.append((String) pwd);
+ } else {
+ result.append(pwd.toString());
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Build a UserTO / GroupTO / AnyObjectTO out of connector object attributes and schema mapping.
+ *
+ * @param obj connector object
+ * @param syncTask synchronization task
+ * @param provision provision information
+ * @param anyUtils utils
+ * @param <T> any object
+ * @return UserTO for the user to be created
+ */
+ @Transactional(readOnly = true)
+ public <T extends AnyTO> T getAnyTO(
+ final ConnectorObject obj, final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
+
+ T anyTO = getAnyTOFromConnObject(obj, syncTask, provision, anyUtils);
+
+ // (for users) if password was not set above, generate
+ if (anyTO instanceof UserTO && StringUtils.isBlank(((UserTO) anyTO).getPassword())) {
+ final UserTO userTO = (UserTO) anyTO;
+
+ List<PasswordRuleConf> ruleConfs = new ArrayList<>();
+
+ Realm realm = realmDAO.find(userTO.getRealm());
+ if (realm != null) {
+ for (Realm ancestor : realmDAO.findAncestors(realm)) {
+ if (ancestor.getPasswordPolicy() != null) {
+ ruleConfs.addAll(ancestor.getPasswordPolicy().getRuleConfs());
+ }
+ }
+ }
+
+ for (String resName : userTO.getResources()) {
+ ExternalResource resource = resourceDAO.find(resName);
+ if (resource != null && resource.getPasswordPolicy() != null) {
+ ruleConfs.addAll(resource.getPasswordPolicy().getRuleConfs());
+ }
+ }
+
+ String password;
+ try {
+ password = passwordGenerator.generate(ruleConfs);
+ } catch (InvalidPasswordRuleConf e) {
+ LOG.error("Could not generate policy-compliant random password for {}", userTO, e);
+
+ password = SecureRandomUtils.generateRandomPassword(16);
+ }
+ userTO.setPassword(password);
+ }
+
+ return anyTO;
+ }
+
+ /**
+ * Build {@link AnyPatch} out of connector object attributes and schema mapping.
+ *
+ * @param key any object to be updated
+ * @param obj connector object
+ * @param original any object to get diff from
+ * @param syncTask synchronization task
+ * @param provision provision information
+ * @param anyUtils utils
+ * @param <T> any object
+ * @return modifications for the any object to be updated
+ */
+ @SuppressWarnings("unchecked")
+ @Transactional(readOnly = true)
+ public <T extends AnyPatch> T getAnyPatch(final Long key, final ConnectorObject obj,
+ final AnyTO original, final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
+
+ AnyTO updated = getAnyTOFromConnObject(obj, syncTask, provision, anyUtils);
+ updated.setKey(key);
+
+ if (AnyTypeKind.USER == anyUtils.getAnyTypeKind()) {
+ // update password if and only if password is really changed
+ User user = userDAO.authFind(key);
+ if (StringUtils.isBlank(((UserTO) updated).getPassword())
+ || ENCRYPTOR.verify(((UserTO) updated).getPassword(),
+ user.getCipherAlgorithm(), user.getPassword())) {
+
+ ((UserTO) updated).setPassword(null);
+ }
+ return (T) AnyOperations.diff(((UserTO) updated), ((UserTO) original), true);
+ } else if (AnyTypeKind.GROUP == anyUtils.getAnyTypeKind()) {
+ return (T) AnyOperations.diff(((GroupTO) updated), ((GroupTO) original), true);
+ } else if (AnyTypeKind.ANY_OBJECT == anyUtils.getAnyTypeKind()) {
+ return (T) AnyOperations.diff(((AnyObjectTO) updated), ((AnyObjectTO) original), true);
+ }
+
+ return null;
+ }
+
+ private <T extends AnyTO> T getAnyTOFromConnObject(final ConnectorObject obj,
+ final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
+
+ T anyTO = anyUtils.newAnyTO();
+ anyTO.setType(provision.getAnyType().getKey());
+
+ // 1. fill with data from connector object
+ anyTO.setRealm(syncTask.getDestinatioRealm().getFullPath());
+ for (MappingItem item : MappingUtils.getSyncMappingItems(provision)) {
+ mappingUtils.setIntValues(item, obj.getAttributeByName(item.getExtAttrName()), anyTO, anyUtils);
+ }
+
+ // 2. add data from defined template (if any)
+ templateUtils.apply(anyTO, syncTask.getTemplate(provision.getAnyType()));
+
+ return anyTO;
+ }
+
+ /**
+ * Get connector object TO from a connector object.
+ *
+ * @param connObject connector object.
+ * @return connector object TO.
+ */
+ public ConnObjectTO getConnObjectTO(final ConnectorObject connObject) {
+ final ConnObjectTO connObjectTO = new ConnObjectTO();
+
+ for (Attribute attr : connObject.getAttributes()) {
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(attr.getName());
+
+ if (attr.getValue() != null) {
+ for (Object value : attr.getValue()) {
+ if (value != null) {
+ if (value instanceof GuardedString || value instanceof GuardedByteArray) {
+ attrTO.getValues().add(getPassword(value));
+ } else if (value instanceof byte[]) {
+ attrTO.getValues().add(Base64.encode((byte[]) value));
+ } else {
+ attrTO.getValues().add(value.toString());
+ }
+ }
+ }
+ }
+
+ connObjectTO.getPlainAttrs().add(attrTO);
+ }
+
+ return connObjectTO;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ExceptionUtils2.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ExceptionUtils2.java b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ExceptionUtils2.java
new file mode 100644
index 0000000..76ba64f
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/ExceptionUtils2.java
@@ -0,0 +1,47 @@
+/*
+ * 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.core.misc.utils;
+
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+public final class ExceptionUtils2 {
+
+ /**
+ * Uses commons lang's ExceptionUtils to provide a representation of the full stack trace of the given throwable.
+ *
+ * @param t throwable to build stack trace from
+ * @return a string representation of full stack trace of the given throwable
+ */
+ public static String getFullStackTrace(final Throwable t) {
+ StringBuilder result = new StringBuilder();
+
+ for (Throwable throwable : ExceptionUtils.getThrowableList(t)) {
+ result.append(ExceptionUtils.getMessage(throwable)).append('\n').
+ append(ExceptionUtils.getStackTrace(throwable)).append("\n\n");
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private ExceptionUtils2() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
new file mode 100644
index 0000000..ec5250a
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
@@ -0,0 +1,117 @@
+/*
+ * 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.core.misc.utils;
+
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.apache.commons.lang3.time.DateUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+
+/**
+ * Utility class for parsing / formatting date and numbers.
+ */
+public final class FormatUtils {
+
+ private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
+
+ @Override
+ protected SimpleDateFormat initialValue() {
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ sdf.applyPattern(SyncopeConstants.DEFAULT_DATE_PATTERN);
+ return sdf;
+ }
+ };
+
+ private static final ThreadLocal<DecimalFormat> DECIMAL_FORMAT = new ThreadLocal<DecimalFormat>() {
+
+ @Override
+ protected DecimalFormat initialValue() {
+ return new DecimalFormat();
+ }
+ };
+
+ public static String format(final Date date) {
+ return format(date, true);
+ }
+
+ public static String format(final Date date, final boolean lenient) {
+ return format(date, lenient, null);
+ }
+
+ public static String format(final Date date, final boolean lenient, final String conversionPattern) {
+ SimpleDateFormat sdf = DATE_FORMAT.get();
+ if (conversionPattern != null) {
+ sdf.applyPattern(conversionPattern);
+ }
+ sdf.setLenient(lenient);
+ return sdf.format(date);
+ }
+
+ public static String format(final long number) {
+ return format(number, null);
+ }
+
+ public static String format(final long number, final String conversionPattern) {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ if (conversionPattern != null) {
+ df.applyPattern(conversionPattern);
+ }
+ return df.format(number);
+ }
+
+ public static String format(final double number) {
+ return format(number, null);
+ }
+
+ public static String format(final double number, final String conversionPattern) {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ if (conversionPattern != null) {
+ df.applyPattern(conversionPattern);
+ }
+ return df.format(number);
+ }
+
+ public static Date parseDate(final String source) throws ParseException {
+ return DateUtils.parseDate(source, SyncopeConstants.DATE_PATTERNS);
+ }
+
+ public static Date parseDate(final String source, final String conversionPattern) throws ParseException {
+ SimpleDateFormat sdf = DATE_FORMAT.get();
+ sdf.applyPattern(conversionPattern);
+ sdf.setLenient(false);
+ return sdf.parse(source);
+ }
+
+ public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ df.applyPattern(conversionPattern);
+ return df.parse(source);
+ }
+
+ public static void clear() {
+ DATE_FORMAT.remove();
+ DECIMAL_FORMAT.remove();
+ }
+
+ private FormatUtils() {
+ // private empty constructor
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/MappingUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/MappingUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/MappingUtils.java
new file mode 100644
index 0000000..bc7c6b8
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/MappingUtils.java
@@ -0,0 +1,831 @@
+/*
+ * 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.core.misc.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.collections4.ListUtils;
+import org.apache.commons.jexl2.JexlContext;
+import org.apache.commons.jexl2.MapContext;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+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.UserTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.misc.policy.InvalidPasswordRuleConf;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
+import org.apache.syncope.core.persistence.api.entity.AnyUtils;
+import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.cache.VirAttrCache;
+import org.apache.syncope.core.misc.security.Encryptor;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
+import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
+import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.entity.Any;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.Schema;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
+import org.apache.syncope.core.persistence.api.entity.resource.Mapping;
+import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.apache.syncope.core.provisioning.api.VirAttrHandler;
+import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
+import org.identityconnectors.framework.common.FrameworkUtil;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
+import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class MappingUtils {
+
+ private static final Logger LOG = LoggerFactory.getLogger(MappingUtils.class);
+
+ private static final Encryptor ENCRYPTOR = Encryptor.getInstance();
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private AnyTypeDAO anyTypeDAO;
+
+ @Autowired
+ private PlainSchemaDAO plainSchemaDAO;
+
+ @Autowired
+ private VirSchemaDAO virSchemaDAO;
+
+ @Autowired
+ private VirAttrHandler virAttrHandler;
+
+ @Autowired
+ private VirAttrCache virAttrCache;
+
+ @Autowired
+ private PasswordGenerator passwordGenerator;
+
+ @Autowired
+ private EntityFactory entityFactory;
+
+ @Autowired
+ private AnyUtilsFactory anyUtilsFactory;
+
+ public static MappingItem getConnObjectKeyItem(final Provision provision) {
+ Mapping mapping = null;
+ if (provision != null) {
+ mapping = provision.getMapping();
+ }
+
+ return mapping == null
+ ? null
+ : mapping.getConnObjectKeyItem();
+ }
+
+ private static List<MappingItem> getMappingItems(final Provision provision, final MappingPurpose purpose) {
+ List<? extends MappingItem> items = Collections.<MappingItem>emptyList();
+ if (provision != null) {
+ items = provision.getMapping().getItems();
+ }
+
+ List<MappingItem> result = new ArrayList<>();
+
+ switch (purpose) {
+ case SYNCHRONIZATION:
+ for (MappingItem item : items) {
+ if (MappingPurpose.PROPAGATION != item.getPurpose()
+ && MappingPurpose.NONE != item.getPurpose()) {
+
+ result.add(item);
+ }
+ }
+ break;
+
+ case PROPAGATION:
+ for (MappingItem item : items) {
+ if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
+ && MappingPurpose.NONE != item.getPurpose()) {
+
+ result.add(item);
+ }
+ }
+ break;
+
+ case BOTH:
+ for (MappingItem item : items) {
+ if (MappingPurpose.NONE != item.getPurpose()) {
+ result.add(item);
+ }
+ }
+ break;
+
+ case NONE:
+ for (MappingItem item : items) {
+ if (MappingPurpose.NONE == item.getPurpose()) {
+ result.add(item);
+ }
+ }
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ public static List<MappingItem> getBothMappingItems(final Provision provision) {
+ return getMappingItems(provision, MappingPurpose.BOTH);
+ }
+
+ public static List<MappingItem> getPropagationMappingItems(final Provision provision) {
+ return getMappingItems(provision, MappingPurpose.PROPAGATION);
+ }
+
+ public static List<MappingItem> getSyncMappingItems(final Provision provision) {
+ return getMappingItems(provision, MappingPurpose.SYNCHRONIZATION);
+ }
+
+ /**
+ * Build __NAME__ for propagation. First look if there ia a defined connObjectLink for the given resource (and in
+ * this case evaluate as JEXL); otherwise, take given connObjectKey.
+ *
+ * @param any given any object
+ * @param provision external resource
+ * @param connObjectKey connector object key
+ * @return the value to be propagated as __NAME__
+ */
+ public static Name evaluateNAME(final Any<?, ?> any, final Provision provision, final String connObjectKey) {
+ if (StringUtils.isBlank(connObjectKey)) {
+ // LOG error but avoid to throw exception: leave it to the external resource
+ LOG.error("Missing ConnObjectKey for '{}': ", provision.getResource());
+ }
+
+ // Evaluate connObjectKey expression
+ String connObjectLink = provision == null || provision.getMapping() == null
+ ? null
+ : provision.getMapping().getConnObjectLink();
+ String evalConnObjectLink = null;
+ if (StringUtils.isNotBlank(connObjectLink)) {
+ JexlContext jexlContext = new MapContext();
+ JexlUtils.addFieldsToContext(any, jexlContext);
+ JexlUtils.addPlainAttrsToContext(any.getPlainAttrs(), jexlContext);
+ JexlUtils.addDerAttrsToContext(any.getDerAttrs(), any.getPlainAttrs(), jexlContext);
+ evalConnObjectLink = JexlUtils.evaluate(connObjectLink, jexlContext);
+ }
+
+ // If connObjectLink evaluates to an empty string, just use the provided connObjectKey as Name(),
+ // otherwise evaluated connObjectLink expression is taken as Name().
+ Name name;
+ if (StringUtils.isBlank(evalConnObjectLink)) {
+ // add connObjectKey as __NAME__ attribute ...
+ LOG.debug("Add connObjectKey [{}] as __NAME__", connObjectKey);
+ name = new Name(connObjectKey);
+ } else {
+ LOG.debug("Add connObjectLink [{}] as __NAME__", evalConnObjectLink);
+ name = new Name(evalConnObjectLink);
+
+ // connObjectKey not propagated: it will be used to set the value for __UID__ attribute
+ LOG.debug("connObjectKey will be used just as __UID__ attribute");
+ }
+
+ return name;
+ }
+
+ public static List<MappingItemTransformer> getMappingItemTransformers(final MappingItem mappingItem) {
+ List<MappingItemTransformer> result = new ArrayList<>();
+
+ for (String className : mappingItem.getMappingItemTransformerClassNames()) {
+ try {
+ Class<?> transformerClass = ClassUtils.getClass(className);
+
+ result.add((MappingItemTransformer) ApplicationContextProvider.
+ getBeanFactory().
+ createBean(transformerClass, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false));
+ } catch (Exception e) {
+ LOG.error("Could not instantiate {}, ignoring...", className, e);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Build options for requesting all mapped connector attributes.
+ *
+ * @param mapItems mapping items
+ * @return options for requesting all mapped connector attributes
+ * @see OperationOptions
+ */
+ public static OperationOptions buildOperationOptions(final Iterator<? extends MappingItem> mapItems) {
+ OperationOptionsBuilder builder = new OperationOptionsBuilder();
+
+ Set<String> attrsToGet = new HashSet<>();
+ attrsToGet.add(Name.NAME);
+ attrsToGet.add(Uid.NAME);
+ attrsToGet.add(OperationalAttributes.ENABLE_NAME);
+
+ while (mapItems.hasNext()) {
+ MappingItem mapItem = mapItems.next();
+ if (mapItem.getPurpose() != MappingPurpose.NONE) {
+ attrsToGet.add(mapItem.getExtAttrName());
+ }
+ }
+
+ builder.setAttributesToGet(attrsToGet);
+ // -------------------------------------
+
+ return builder.build();
+ }
+
+ /**
+ * Prepare attributes for sending to a connector instance.
+ *
+ * @param any given any object
+ * @param password clear-text password
+ * @param changePwd whether password should be included for propagation attributes or not
+ * @param enable whether any object must be enabled or not
+ * @param provision provision information
+ * @return connObjectLink + prepared attributes
+ */
+ @Transactional(readOnly = true)
+ public Pair<String, Set<Attribute>> prepareAttrs(
+ final Any<?, ?> any,
+ final String password,
+ final boolean changePwd,
+ final Boolean enable,
+ final Provision provision) {
+
+ LOG.debug("Preparing resource attributes for {} with provision {} for attributes {}",
+ any, provision, any.getPlainAttrs());
+
+ Set<Attribute> attributes = new HashSet<>();
+ String connObjectKey = null;
+
+ for (MappingItem mappingItem : getMappingItems(provision, MappingPurpose.PROPAGATION)) {
+ LOG.debug("Processing schema {}", mappingItem.getIntAttrName());
+
+ try {
+ Pair<String, Attribute> preparedAttr = prepareAttr(provision, mappingItem, any, password);
+
+ if (preparedAttr != null && preparedAttr.getKey() != null) {
+ connObjectKey = preparedAttr.getKey();
+ }
+
+ if (preparedAttr != null && preparedAttr.getValue() != null) {
+ Attribute alreadyAdded = AttributeUtil.find(preparedAttr.getValue().getName(), attributes);
+
+ if (alreadyAdded == null) {
+ attributes.add(preparedAttr.getValue());
+ } else {
+ attributes.remove(alreadyAdded);
+
+ Set<Object> values = new HashSet<>(alreadyAdded.getValue());
+ values.addAll(preparedAttr.getValue().getValue());
+
+ attributes.add(AttributeBuilder.build(preparedAttr.getValue().getName(), values));
+ }
+ }
+ } catch (Exception e) {
+ LOG.debug("Attribute '{}' processing failed", mappingItem.getIntAttrName(), e);
+ }
+ }
+
+ Attribute connObjectKeyExtAttr =
+ AttributeUtil.find(getConnObjectKeyItem(provision).getExtAttrName(), attributes);
+ if (connObjectKeyExtAttr != null) {
+ attributes.remove(connObjectKeyExtAttr);
+ attributes.add(AttributeBuilder.build(getConnObjectKeyItem(provision).getExtAttrName(), connObjectKey));
+ }
+ attributes.add(evaluateNAME(any, provision, connObjectKey));
+
+ if (enable != null) {
+ attributes.add(AttributeBuilder.buildEnabled(enable));
+ }
+ if (!changePwd) {
+ Attribute pwdAttr = AttributeUtil.find(OperationalAttributes.PASSWORD_NAME, attributes);
+ if (pwdAttr != null) {
+ attributes.remove(pwdAttr);
+ }
+ }
+
+ return new ImmutablePair<>(connObjectKey, attributes);
+ }
+
+ /**
+ * Prepare an attribute to be sent to a connector instance.
+ *
+ * @param provision external resource
+ * @param mapItem mapping item for the given attribute
+ * @param any any object
+ * @param password clear-text password
+ * @return connObjectLink + prepared attribute
+ */
+ private Pair<String, Attribute> prepareAttr(
+ final Provision provision, final MappingItem mapItem, final Any<?, ?> any, final String password) {
+
+ List<Any<?, ?>> anys = new ArrayList<>();
+
+ switch (mapItem.getIntMappingType().getAnyTypeKind()) {
+ case USER:
+ if (any instanceof User) {
+ anys.add(any);
+ }
+ break;
+
+ case GROUP:
+ if (any instanceof User) {
+ for (Group group : userDAO.findAllGroups((User) any)) {
+ anys.add(group);
+ }
+ } else if (any instanceof Group) {
+ anys.add(any);
+ }
+ break;
+
+ case ANY_OBJECT:
+ if (any instanceof AnyObject) {
+ anys.add(any);
+ }
+ break;
+
+ default:
+ }
+
+ Schema schema = null;
+ boolean readOnlyVirSchema = false;
+ AttrSchemaType schemaType;
+ Pair<String, Attribute> result;
+
+ switch (mapItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case AnyObjectPlainSchema:
+ schema = plainSchemaDAO.find(mapItem.getIntAttrName());
+ schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ case AnyObjectVirtualSchema:
+ schema = virSchemaDAO.find(mapItem.getIntAttrName());
+ readOnlyVirSchema = (schema != null && schema.isReadonly());
+ schemaType = AttrSchemaType.String;
+ break;
+
+ default:
+ schemaType = AttrSchemaType.String;
+ }
+
+ String extAttrName = mapItem.getExtAttrName();
+
+ List<PlainAttrValue> values = getIntValues(provision, mapItem, anys);
+
+ LOG.debug("Define mapping for: "
+ + "\n* ExtAttrName " + extAttrName
+ + "\n* is connObjectKey " + mapItem.isConnObjectKey()
+ + "\n* is password " + (mapItem.isPassword() || mapItem.getIntMappingType() == IntMappingType.Password)
+ + "\n* mandatory condition " + mapItem.getMandatoryCondition()
+ + "\n* Schema " + mapItem.getIntAttrName()
+ + "\n* IntMappingType " + mapItem.getIntMappingType().toString()
+ + "\n* ClassType " + schemaType.getType().getName()
+ + "\n* Values " + values);
+
+ if (readOnlyVirSchema) {
+ result = null;
+ } else {
+ List<Object> objValues = new ArrayList<>();
+
+ for (PlainAttrValue value : values) {
+ if (FrameworkUtil.isSupportedAttributeType(schemaType.getType())) {
+ objValues.add(value.getValue());
+ } else {
+ objValues.add(value.getValueAsString());
+ }
+ }
+
+ if (mapItem.isConnObjectKey()) {
+ result = new ImmutablePair<>(objValues.iterator().next().toString(), null);
+ } else if (mapItem.isPassword() && any instanceof User) {
+ String passwordAttrValue = password;
+ if (StringUtils.isBlank(passwordAttrValue)) {
+ User user = (User) any;
+ if (user.canDecodePassword()) {
+ try {
+ passwordAttrValue = ENCRYPTOR.decode(user.getPassword(), user.getCipherAlgorithm());
+ } catch (Exception e) {
+ LOG.error("Could not decode password for {}", user, e);
+ }
+ } else if (provision.getResource().isRandomPwdIfNotProvided()) {
+ try {
+ passwordAttrValue = passwordGenerator.generate(user);
+ } catch (InvalidPasswordRuleConf e) {
+ LOG.error("Could not generate policy-compliant random password for {}", user, e);
+ }
+ }
+ }
+
+ if (passwordAttrValue == null) {
+ result = null;
+ } else {
+ result = new ImmutablePair<>(
+ null, AttributeBuilder.buildPassword(passwordAttrValue.toCharArray()));
+ }
+ } else {
+ if ((schema != null && schema.isMultivalue())
+ || anyUtilsFactory.getInstance(any).getAnyTypeKind()
+ != mapItem.getIntMappingType().getAnyTypeKind()) {
+
+ result = new ImmutablePair<>(
+ null, AttributeBuilder.build(extAttrName, objValues));
+ } else {
+ result = new ImmutablePair<>(
+ null, objValues.isEmpty()
+ ? AttributeBuilder.build(extAttrName)
+ : AttributeBuilder.build(extAttrName, objValues.iterator().next()));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private String getGroupOwnerValue(final Provision provision, final Any<?, ?> any) {
+ Pair<String, Attribute> preparedAttr = prepareAttr(provision, getConnObjectKeyItem(provision), any, null);
+ String connObjectKey = preparedAttr.getKey();
+
+ return evaluateNAME(any, provision, connObjectKey).getNameValue();
+ }
+
+ /**
+ * Get attribute values for the given {@link MappingItem} and any objects.
+ *
+ * @param provision provision information
+ * @param mappingItem mapping item
+ * @param anys any objects
+ * @return attribute values.
+ */
+ @Transactional(readOnly = true)
+ public List<PlainAttrValue> getIntValues(final Provision provision,
+ final MappingItem mappingItem, final List<Any<?, ?>> anys) {
+
+ LOG.debug("Get attributes for '{}' and mapping type '{}'", anys, mappingItem.getIntMappingType());
+
+ boolean transform = true;
+
+ List<PlainAttrValue> values = new ArrayList<>();
+ switch (mappingItem.getIntMappingType()) {
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case AnyObjectPlainSchema:
+ for (Any<?, ?> any : anys) {
+ PlainAttr<?> attr = any.getPlainAttr(mappingItem.getIntAttrName());
+ if (attr != null) {
+ if (attr.getUniqueValue() != null) {
+ PlainAttrUniqueValue value = SerializationUtils.clone(attr.getUniqueValue());
+ value.setAttr(null);
+ values.add(value);
+ } else if (attr.getValues() != null) {
+ for (PlainAttrValue value : attr.getValues()) {
+ PlainAttrValue shadow = SerializationUtils.clone(value);
+ shadow.setAttr(null);
+ values.add(shadow);
+ }
+ }
+ }
+
+ LOG.debug("Retrieved attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
+ case AnyObjectDerivedSchema:
+ for (Any<?, ?> any : anys) {
+ AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
+ DerAttr<?> attr = any.getDerAttr(mappingItem.getIntAttrName());
+ if (attr != null) {
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ attrValue.setStringValue(attr.getValue(any.getPlainAttrs()));
+ values.add(attrValue);
+ }
+
+ LOG.debug("Retrieved attribute {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ attr, mappingItem.getIntAttrName(), mappingItem.getIntMappingType(), values);
+ }
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ case AnyObjectVirtualSchema:
+ // virtual attributes don't get transformed
+ transform = false;
+
+ VirSchema virSchema = virSchemaDAO.find(mappingItem.getIntAttrName());
+ if (virSchema != null) {
+ for (Any<?, ?> any : anys) {
+ LOG.debug("Expire entry cache {}-{}", any.getKey(), mappingItem.getIntAttrName());
+ virAttrCache.expire(any.getType().getKey(), any.getKey(), mappingItem.getIntAttrName());
+
+ AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
+ for (String value : virAttrHandler.getValues(any, virSchema)) {
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ attrValue.setStringValue(value);
+ values.add(attrValue);
+ }
+
+ LOG.debug("Retrieved values for {}"
+ + "\n* IntAttrName {}"
+ + "\n* IntMappingType {}"
+ + "\n* Attribute values {}",
+ virSchema.getKey(), mappingItem.getIntAttrName(), mappingItem.getIntMappingType(),
+ values);
+ }
+ }
+ break;
+
+ case UserKey:
+ case GroupKey:
+ case AnyObjectKey:
+ for (Any<?, ?> any : anys) {
+ AnyUtils anyUtils = anyUtilsFactory.getInstance(any);
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ attrValue.setStringValue(any.getKey().toString());
+ values.add(attrValue);
+ }
+ break;
+
+ case Username:
+ for (Any<?, ?> any : anys) {
+ if (any instanceof User) {
+ UPlainAttrValue attrValue = entityFactory.newEntity(UPlainAttrValue.class);
+ attrValue.setStringValue(((User) any).getUsername());
+ values.add(attrValue);
+ }
+ }
+ break;
+
+ case GroupName:
+ for (Any<?, ?> any : anys) {
+ if (any instanceof Group) {
+ GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(((Group) any).getName());
+ values.add(attrValue);
+ }
+ }
+ break;
+
+ case GroupOwnerSchema:
+ Mapping uMapping = provision.getAnyType().equals(anyTypeDAO.findUser())
+ ? null
+ : provision.getMapping();
+ Mapping gMapping = provision.getAnyType().equals(anyTypeDAO.findGroup())
+ ? null
+ : provision.getMapping();
+
+ for (Any<?, ?> any : anys) {
+ if (any instanceof Group) {
+ Group group = (Group) any;
+ String groupOwnerValue = null;
+ if (group.getUserOwner() != null && uMapping != null) {
+ groupOwnerValue = getGroupOwnerValue(provision, group.getUserOwner());
+ }
+ if (group.getGroupOwner() != null && gMapping != null) {
+ groupOwnerValue = getGroupOwnerValue(provision, group.getGroupOwner());
+ }
+
+ if (StringUtils.isNotBlank(groupOwnerValue)) {
+ GPlainAttrValue attrValue = entityFactory.newEntity(GPlainAttrValue.class);
+ attrValue.setStringValue(groupOwnerValue);
+ values.add(attrValue);
+ }
+ }
+ }
+ break;
+
+ default:
+ }
+
+ LOG.debug("Values for propagation: {}", values);
+
+ List<PlainAttrValue> transformed = values;
+ if (transform) {
+ for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItem)) {
+ transformed = transformer.beforePropagation(transformed);
+ }
+ LOG.debug("Transformed values for propagation: {}", values);
+ } else {
+ LOG.debug("No transformation occurred");
+ }
+
+ return transformed;
+ }
+
+ /**
+ * Get connObjectKey internal value.
+ *
+ * @param any any object
+ * @param provision provision information
+ * @return connObjectKey internal value
+ */
+ @Transactional(readOnly = true)
+ public String getConnObjectKeyValue(final Any<?, ?> any, final Provision provision) {
+ List<PlainAttrValue> values = getIntValues(provision, provision.getMapping().getConnObjectKeyItem(),
+ Collections.<Any<?, ?>>singletonList(any));
+ return values == null || values.isEmpty()
+ ? null
+ : values.get(0).getValueAsString();
+ }
+
+ /**
+ * Set attribute values, according to the given {@link MappingItem}, to any object from attribute received from
+ * connector.
+ *
+ * @param <T> any object
+ * @param mappingItem mapping item
+ * @param attr attribute received from connector
+ * @param anyTO any object
+ * @param anyUtils any utils
+ */
+ @Transactional(readOnly = true)
+ public <T extends AnyTO> void setIntValues(
+ final MappingItem mappingItem, final Attribute attr, final T anyTO, final AnyUtils anyUtils) {
+
+ List<Object> values = null;
+ if (attr != null) {
+ values = attr.getValue();
+ for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItem)) {
+ values = transformer.beforeSync(values);
+ }
+ }
+ values = ListUtils.emptyIfNull(values);
+
+ switch (mappingItem.getIntMappingType()) {
+ case UserKey:
+ case GroupKey:
+ case AnyObjectKey:
+ break;
+
+ case Password:
+ if (anyTO instanceof UserTO && !values.isEmpty()) {
+ ((UserTO) anyTO).setPassword(ConnObjectUtils.getPassword(values.get(0)));
+ }
+ break;
+
+ case Username:
+ if (anyTO instanceof UserTO) {
+ ((UserTO) anyTO).setUsername(values.isEmpty() || values.get(0) == null
+ ? null
+ : values.get(0).toString());
+ }
+ break;
+
+ case GroupName:
+ if (anyTO instanceof GroupTO) {
+ ((GroupTO) anyTO).setName(values.isEmpty() || values.get(0) == null
+ ? null
+ : values.get(0).toString());
+ }
+ break;
+
+ case GroupOwnerSchema:
+ if (anyTO instanceof GroupTO && attr != null) {
+ // using a special attribute (with schema "", that will be ignored) for carrying the
+ // GroupOwnerSchema value
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(StringUtils.EMPTY);
+ if (values.isEmpty() || values.get(0) == null) {
+ attrTO.getValues().add(StringUtils.EMPTY);
+ } else {
+ attrTO.getValues().add(values.get(0).toString());
+ }
+
+ ((GroupTO) anyTO).getPlainAttrs().add(attrTO);
+ }
+ break;
+
+ case UserPlainSchema:
+ case GroupPlainSchema:
+ case AnyObjectPlainSchema:
+ AttrTO attrTO = new AttrTO();
+ attrTO.setSchema(mappingItem.getIntAttrName());
+
+ PlainSchema schema = plainSchemaDAO.find(mappingItem.getIntAttrName());
+
+ for (Object value : values) {
+ AttrSchemaType schemaType = schema == null ? AttrSchemaType.String : schema.getType();
+ if (value != null) {
+ PlainAttrValue attrValue = anyUtils.newPlainAttrValue();
+ switch (schemaType) {
+ case String:
+ attrValue.setStringValue(value.toString());
+ break;
+
+ case Binary:
+ attrValue.setBinaryValue((byte[]) value);
+ break;
+
+ default:
+ try {
+ attrValue.parseValue(schema, value.toString());
+ } catch (ParsingValidationException e) {
+ LOG.error("While parsing provided value {}", value, e);
+ attrValue.setStringValue(value.toString());
+ schemaType = AttrSchemaType.String;
+ }
+ break;
+ }
+ attrTO.getValues().add(attrValue.getValueAsString(schemaType));
+ }
+ }
+
+ anyTO.getPlainAttrs().add(attrTO);
+ break;
+
+ case UserDerivedSchema:
+ case GroupDerivedSchema:
+ case AnyObjectDerivedSchema:
+ attrTO = new AttrTO();
+ attrTO.setSchema(mappingItem.getIntAttrName());
+ anyTO.getDerAttrs().add(attrTO);
+ break;
+
+ case UserVirtualSchema:
+ case GroupVirtualSchema:
+ case AnyObjectVirtualSchema:
+ attrTO = new AttrTO();
+ attrTO.setSchema(mappingItem.getIntAttrName());
+
+ // virtual attributes don't get transformed, iterate over original attr.getValue()
+ for (Object value : (attr == null || attr.getValue() == null)
+ ? Collections.emptyList() : attr.getValue()) {
+
+ if (value != null) {
+ attrTO.getValues().add(value.toString());
+ }
+ }
+
+ anyTO.getVirAttrs().add(attrTO);
+ break;
+
+ default:
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/RealmUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/RealmUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/RealmUtils.java
new file mode 100644
index 0000000..cddda67
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/RealmUtils.java
@@ -0,0 +1,61 @@
+/*
+ * 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.core.misc.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+public final class RealmUtils {
+
+ public static String getGroupOwnerRealm(final String realmPath, final Long groupKey) {
+ return realmPath + "@" + groupKey;
+ }
+
+ public static boolean normalizingAddTo(final Set<String> realms, final String newRealm) {
+ boolean dontAdd = false;
+ Set<String> toRemove = new HashSet<>();
+ for (String realm : realms) {
+ if (newRealm.startsWith(realm)) {
+ dontAdd = true;
+ } else if (realm.startsWith(newRealm)) {
+ toRemove.add(realm);
+ }
+ }
+
+ realms.removeAll(toRemove);
+ if (!dontAdd) {
+ realms.add(newRealm);
+ }
+ return !dontAdd;
+ }
+
+ public static Set<String> normalize(final Collection<String> realms) {
+ Set<String> normalized = new HashSet<>();
+ for (String realm : realms) {
+ normalizingAddTo(normalized, realm);
+ }
+
+ return normalized;
+ }
+
+ private RealmUtils() {
+ // empty constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/TemplateUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/TemplateUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/TemplateUtils.java
new file mode 100644
index 0000000..4b990f2
--- /dev/null
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/TemplateUtils.java
@@ -0,0 +1,223 @@
+/*
+ * 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.core.misc.utils;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+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.MembershipTO;
+import org.apache.syncope.common.lib.to.RelationshipTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.core.misc.jexl.JexlUtils;
+import org.apache.syncope.core.persistence.api.dao.GroupDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.entity.AnyTemplate;
+import org.apache.syncope.core.persistence.api.entity.group.Group;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class TemplateUtils {
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Autowired
+ private GroupDAO groupDAO;
+
+ private AttrTO evaluateAttr(final AnyTO anyTO, final AttrTO template) {
+ AttrTO result = new AttrTO();
+ result.setSchema(template.getSchema());
+
+ if (template.getValues() != null && !template.getValues().isEmpty()) {
+ for (String value : template.getValues()) {
+ String evaluated = JexlUtils.evaluate(value, anyTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ result.getValues().add(evaluated);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private void fill(final AnyTO anyTO, final AnyTO template) {
+ if (template.getRealm() != null) {
+ anyTO.setRealm(template.getRealm());
+ }
+
+ Map<String, AttrTO> currentAttrMap = anyTO.getPlainAttrMap();
+ for (AttrTO templatePlainAttr : template.getPlainAttrs()) {
+ if (!templatePlainAttr.getValues().isEmpty()
+ && (!currentAttrMap.containsKey(templatePlainAttr.getSchema())
+ || currentAttrMap.get(templatePlainAttr.getSchema()).getValues().isEmpty())) {
+
+ anyTO.getPlainAttrs().add(evaluateAttr(anyTO, templatePlainAttr));
+ }
+ }
+
+ currentAttrMap = anyTO.getDerAttrMap();
+ for (AttrTO templateDerAttr : template.getDerAttrs()) {
+ if (!currentAttrMap.containsKey(templateDerAttr.getSchema())) {
+ anyTO.getDerAttrs().add(templateDerAttr);
+ }
+ }
+
+ currentAttrMap = anyTO.getVirAttrMap();
+ for (AttrTO templateVirAttr : template.getVirAttrs()) {
+ if (!templateVirAttr.getValues().isEmpty()
+ && (!currentAttrMap.containsKey(templateVirAttr.getSchema())
+ || currentAttrMap.get(templateVirAttr.getSchema()).getValues().isEmpty())) {
+
+ anyTO.getVirAttrs().add(evaluateAttr(anyTO, templateVirAttr));
+ }
+ }
+
+ for (String resource : template.getResources()) {
+ anyTO.getResources().add(resource);
+ }
+
+ anyTO.getAuxClasses().addAll(template.getAuxClasses());
+ }
+
+ private void fillRelationships(final Map<Long, RelationshipTO> anyRelMap,
+ final List<RelationshipTO> anyRels, final List<RelationshipTO> templateRels) {
+
+ for (RelationshipTO memb : templateRels) {
+ if (!anyRelMap.containsKey(memb.getRightKey())) {
+ anyRels.add(memb);
+ }
+ }
+ }
+
+ private void fillMemberships(final Map<Long, MembershipTO> anyMembMap,
+ final List<MembershipTO> anyMembs, final List<MembershipTO> templateMembs) {
+
+ for (MembershipTO memb : templateMembs) {
+ if (!anyMembMap.containsKey(memb.getRightKey())) {
+ anyMembs.add(memb);
+ }
+ }
+ }
+
+ @Transactional(readOnly = true)
+ public <T extends AnyTO> void apply(final T anyTO, final AnyTemplate anyTemplate) {
+ if (anyTemplate != null) {
+ AnyTO template = anyTemplate.get();
+ fill(anyTO, template);
+
+ if (template instanceof AnyObjectTO) {
+ fillRelationships(((AnyObjectTO) anyTO).getRelationshipMap(),
+ ((AnyObjectTO) anyTO).getRelationships(), ((AnyObjectTO) template).getRelationships());
+ fillMemberships(((AnyObjectTO) anyTO).getMembershipMap(),
+ ((AnyObjectTO) anyTO).getMemberships(), ((AnyObjectTO) template).getMemberships());
+ } else if (template instanceof UserTO) {
+ if (StringUtils.isNotBlank(((UserTO) template).getUsername())) {
+ String evaluated = JexlUtils.evaluate(((UserTO) template).getUsername(), anyTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((UserTO) anyTO).setUsername(evaluated);
+ }
+ }
+
+ if (StringUtils.isNotBlank(((UserTO) template).getPassword())) {
+ String evaluated = JexlUtils.evaluate(((UserTO) template).getPassword(), anyTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((UserTO) anyTO).setPassword(evaluated);
+ }
+ }
+
+ fillRelationships(((UserTO) anyTO).getRelationshipMap(),
+ ((UserTO) anyTO).getRelationships(), ((UserTO) template).getRelationships());
+ fillMemberships(((UserTO) anyTO).getMembershipMap(),
+ ((UserTO) anyTO).getMemberships(), ((UserTO) template).getMemberships());
+ } else if (template instanceof GroupTO) {
+ if (StringUtils.isNotBlank(((GroupTO) template).getName())) {
+ String evaluated = JexlUtils.evaluate(((GroupTO) template).getName(), anyTO);
+ if (StringUtils.isNotBlank(evaluated)) {
+ ((GroupTO) anyTO).setName(evaluated);
+ }
+ }
+
+ if (((GroupTO) template).getUserOwner() != null) {
+ final User userOwner = userDAO.find(((GroupTO) template).getUserOwner());
+ if (userOwner != null) {
+ ((GroupTO) anyTO).setUserOwner(userOwner.getKey());
+ }
+ }
+ if (((GroupTO) template).getGroupOwner() != null) {
+ final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner());
+ if (groupOwner != null) {
+ ((GroupTO) anyTO).setGroupOwner(groupOwner.getKey());
+ }
+ }
+ }
+ }
+ }
+
+ public void check(final Map<String, AnyTO> templates, final ClientExceptionType clientExceptionType) {
+ SyncopeClientException sce = SyncopeClientException.build(clientExceptionType);
+
+ for (Map.Entry<String, AnyTO> entry : templates.entrySet()) {
+ for (AttrTO attrTO : entry.getValue().getPlainAttrs()) {
+ if (!attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))) {
+ sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0));
+ }
+ }
+
+ for (AttrTO attrTO : entry.getValue().getVirAttrs()) {
+ if (!attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))) {
+ sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0));
+ }
+ }
+
+ if (entry.getValue() instanceof UserTO) {
+ UserTO template = (UserTO) entry.getValue();
+ if (StringUtils.isNotBlank(template.getUsername())
+ && !JexlUtils.isExpressionValid(template.getUsername())) {
+
+ sce.getElements().add("Invalid JEXL: " + template.getUsername());
+ }
+ if (StringUtils.isNotBlank(template.getPassword())
+ && !JexlUtils.isExpressionValid(template.getPassword())) {
+
+ sce.getElements().add("Invalid JEXL: " + template.getPassword());
+ }
+ } else if (entry.getValue() instanceof GroupTO) {
+ GroupTO template = (GroupTO) entry.getValue();
+ if (StringUtils.isNotBlank(template.getName())
+ && !JexlUtils.isExpressionValid(template.getName())) {
+
+ sce.getElements().add("Invalid JEXL: " + template.getName());
+ }
+ }
+ }
+
+ if (!sce.isEmpty()) {
+ throw sce;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/misc/src/main/resources/utilsContext.xml
----------------------------------------------------------------------
diff --git a/core/misc/src/main/resources/utilsContext.xml b/core/misc/src/main/resources/utilsContext.xml
new file mode 100644
index 0000000..7b2c9b3
--- /dev/null
+++ b/core/misc/src/main/resources/utilsContext.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd">
+
+ <bean class="org.apache.syncope.core.misc.AuditManager"/>
+
+ <context:component-scan base-package="org.apache.syncope.core.misc.utils"/>
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
index 125b447..9cf2b32 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
@@ -27,7 +27,7 @@ import java.util.Map;
import javax.sql.DataSource;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
index 9512849..3c8b0ad 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentExporter.java
@@ -50,7 +50,7 @@ import javax.xml.transform.stream.StreamResult;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.content.ContentExporter;
import org.apache.syncope.core.persistence.jpa.entity.JPAReportExec;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/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 2acd683..f02b4ba 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
@@ -39,7 +39,7 @@ import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.core.misc.RealmUtils;
+import org.apache.syncope.core.misc.utils.RealmUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
index 4c29c90..86e6275 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAGroupDAO.java
@@ -38,7 +38,7 @@ import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup;
import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.misc.RealmUtils;
+import org.apache.syncope.core.misc.utils.RealmUtils;
import org.apache.syncope.core.misc.search.SearchCondConverter;
import org.apache.syncope.core.misc.security.AuthContextUtils;
import org.apache.syncope.core.misc.security.DelegatedAdministrationException;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
index 7032df6..754da9f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java
@@ -32,7 +32,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.syncope.common.lib.types.AttrSchemaType;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/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 8640c50..126c1e1 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
@@ -31,7 +31,7 @@ import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
import org.apache.syncope.core.provisioning.api.ConnPoolConfUtils;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
index 94c68ee..182d3cf 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/VirAttrHandlerImpl.java
@@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
index 93a0b31..4af649f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AbstractAnyDataBinder.java
@@ -63,8 +63,8 @@ import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.group.Group;
import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.core.misc.ConnObjectUtils;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.ConnObjectUtils;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.misc.jexl.JexlUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
index af7f0a0..3bb1ed6 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/RealmDataBinderImpl.java
@@ -24,7 +24,7 @@ import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.core.misc.TemplateUtils;
+import org.apache.syncope.core.misc.utils.TemplateUtils;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.dao.RealmDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java
----------------------------------------------------------------------
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 32a095b..e0f8cd8 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
@@ -35,7 +35,7 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.MatchingRule;
import org.apache.syncope.common.lib.types.TaskType;
import org.apache.syncope.common.lib.types.UnmatchingRule;
-import org.apache.syncope.core.misc.TemplateUtils;
+import org.apache.syncope.core.misc.utils.TemplateUtils;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.TaskExecDAO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
----------------------------------------------------------------------
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 3042239..e3b06b8 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/java/job/AbstractSchedTaskJobDelegate.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.provisioning.java.job;
import java.util.Date;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.core.misc.AuditManager;
-import org.apache.syncope.core.misc.ExceptionUtils2;
+import org.apache.syncope.core.misc.utils.ExceptionUtils2;
import org.apache.syncope.core.persistence.api.dao.TaskDAO;
import org.apache.syncope.core.persistence.api.dao.TaskExecDAO;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/TaskJob.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/TaskJob.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/TaskJob.java
index 7c6d34c..e3682de 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/TaskJob.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/TaskJob.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.provisioning.java.job;
import java.util.Date;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.lang3.ClassUtils;
-import org.apache.syncope.core.misc.FormatUtils;
+import org.apache.syncope.core.misc.utils.FormatUtils;
import org.apache.syncope.core.misc.security.AuthContextUtils;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.provisioning.api.job.JobInstanceLoader;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
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 e87cd00..d513069 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
@@ -46,9 +46,9 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.misc.AuditManager;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
-import org.apache.syncope.core.misc.ConnObjectUtils;
-import org.apache.syncope.core.misc.ExceptionUtils2;
-import org.apache.syncope.core.misc.MappingUtils;
+import org.apache.syncope.core.misc.utils.ConnObjectUtils;
+import org.apache.syncope.core.misc.utils.ExceptionUtils2;
+import org.apache.syncope.core.misc.utils.MappingUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.entity.Any;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
index 22feb44..d635e15 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationReporter.java
@@ -24,7 +24,7 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.apache.syncope.core.misc.ConnObjectUtils;
+import org.apache.syncope.core.misc.utils.ConnObjectUtils;
import org.identityconnectors.framework.common.objects.ConnectorObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0211410b/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 a3c4951..90d56ba 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
@@ -31,20 +31,19 @@ import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
-import org.springframework.stereotype.Component;
-@Component
+/**
+ * Sort the given collection by looking at related ExternalResource's priority, then execute.
+ */
public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExecutor {
- /**
- * Sort the given collection by looking at related ExternalResource's priority, then execute.
- * {@inheritDoc}
- */
@Override
public void execute(final Collection<PropagationTask> tasks, final PropagationReporter reporter) {
- final List<PropagationTask> prioritizedTasks = new ArrayList<>(tasks);
+ List<PropagationTask> prioritizedTasks = new ArrayList<>(tasks);
Collections.sort(prioritizedTasks, new PriorityComparator());
+ LOG.debug("Propagation tasks sorted by priority, before execution: {}", prioritizedTasks);
+
Result result = Result.SUCCESS;
try {
[35/50] [abbrv] syncope git commit: [SYNCOPE-142] Improving test
execution on fast hw
Posted by fm...@apache.org.
[SYNCOPE-142] Improving test execution on fast hw
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/764fa2ec
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/764fa2ec
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/764fa2ec
Branch: refs/heads/SYNCOPE-156
Commit: 764fa2eca81fc37d52b2dd09c49efb6b9e0b1312
Parents: 1b81e33
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Oct 29 18:21:41 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Oct 29 18:21:41 2015 +0100
----------------------------------------------------------------------
.../java/org/apache/syncope/fit/core/reference/UserITCase.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/764fa2ec/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
index 0fb428d..94e51d7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
@@ -971,8 +971,10 @@ public class UserITCase extends AbstractITCase {
}
});
assertEquals(PropagationTaskExecStatus.SUCCESS, byResource.get(RESOURCE_NAME_LDAP).getStatus());
- assertEquals(PropagationTaskExecStatus.CREATED, byResource.get(RESOURCE_NAME_TESTDB).getStatus());
- assertEquals(PropagationTaskExecStatus.CREATED, byResource.get(RESOURCE_NAME_TESTDB2).getStatus());
+ assertTrue(byResource.get(RESOURCE_NAME_TESTDB).getStatus() == PropagationTaskExecStatus.CREATED
+ || byResource.get(RESOURCE_NAME_TESTDB).getStatus() == PropagationTaskExecStatus.SUCCESS);
+ assertTrue(byResource.get(RESOURCE_NAME_TESTDB2).getStatus() == PropagationTaskExecStatus.CREATED
+ || byResource.get(RESOURCE_NAME_TESTDB2).getStatus() == PropagationTaskExecStatus.SUCCESS);
}
@Test
[09/50] [abbrv] syncope git commit: Attempting again to succeed with
Travis CI
Posted by fm...@apache.org.
Attempting again to succeed with Travis CI
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/586df517
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/586df517
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/586df517
Branch: refs/heads/SYNCOPE-156
Commit: 586df51796d4aeb7b6660fdfd7c23390f7d9d2be
Parents: 4aea776
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 26 14:14:46 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 26 14:14:46 2015 +0100
----------------------------------------------------------------------
.travis.yml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/586df517/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c6894ea..3cba257 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+sudo: false
cache:
directories:
- $HOME/.m2
@@ -21,10 +22,8 @@ jdk:
- openjdk7
# default install is mvn install --quiet -DskipTests=true
install: mvn --show-version --quiet -P all,skipTests
-#invoker.streamLogs: we cannot access to log files through Travis web ui, so display everything in the console
script:
- - sudo rm /etc/mavenrc
- - export MAVEN_OPTS="-Xmx2048m -Xms1024m -XX:MaxPermSize=512m -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
+ #invoker.streamLogs: we cannot access to log files through Travis web ui, so display everything in the console
- mvn --show-version --quiet clean install -Dinvoker.streamLogs=true
notifications:
email:
[48/50] [abbrv] syncope git commit: provides wizard to create users,
groups and any objects + several changes merged from master
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
index 2b3c49d..e030ef7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.panels.AbstractModalPanel;
+import org.apache.syncope.client.console.panels.ModalPanel;
import org.apache.syncope.client.console.panels.NotificationPanel;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.buttons.DefaultModalCloseButton;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.buttons.PrimaryModalButton;
@@ -39,6 +40,7 @@ import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.slf4j.Logger;
@@ -63,7 +65,7 @@ public class BaseModal<T extends Serializable> extends Modal<T> {
private WindowClosedCallback windowClosedCallback;
- private AbstractModalPanel content;
+ private Panel content;
private PrimaryModalButton submitButton;
@@ -127,11 +129,19 @@ public class BaseModal<T extends Serializable> extends Modal<T> {
return form.getModelObject();
}
- public AbstractModalPanel getContent() {
- return content;
+ public ModalPanel getContent() {
+ return ModalPanel.class.cast(content);
}
- public BaseModal<T> setContent(final AbstractModalPanel component) {
+ public BaseModal<T> setContent(final ModalPanel component) {
+ if (component instanceof Panel) {
+ return setInternalContent(Panel.class.cast(component));
+ }
+ throw new IllegalArgumentException("Panel instance is required");
+
+ }
+
+ private BaseModal<T> setInternalContent(final Panel component) {
if (!component.getId().equals(getContentId())) {
throw new WicketRuntimeException(
"Modal content id is wrong. Component ID:" + component.getId() + "; content ID: " + getContentId());
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
index 8ad55f6..fda21bf 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksPanel.java
@@ -53,6 +53,8 @@ public final class ActionLinksPanel<T extends Serializable> extends Panel {
this.model = model;
this.pageRef = pageRef;
+ setOutputMarkupId(true);
+
super.add(new Fragment("panelClaim", "emptyFragment", this));
super.add(new Fragment("panelManageResources", "emptyFragment", this));
super.add(new Fragment("panelManageUsers", "emptyFragment", this));
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index b7a524a..1311980 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -19,6 +19,7 @@
package org.apache.syncope.client.console.wicket.markup.html.form;
import java.io.ByteArrayInputStream;
+import java.lang.reflect.InvocationTargetException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
@@ -61,7 +62,7 @@ public class BinaryFieldPanel extends FieldPanel<String> {
private final Fragment emptyFragment;
- private final PreviewUtils previewUtils = PreviewUtils.getInstance();
+ private final transient PreviewUtils previewUtils = PreviewUtils.getInstance();
public BinaryFieldPanel(final String id, final String name, final IModel<String> model, final String mimeType) {
super(id, model);
@@ -135,7 +136,7 @@ public class BinaryFieldPanel extends FieldPanel<String> {
uploadForm.addOrReplace(fileUpload);
downloadLink.setEnabled(StringUtils.isNotBlank(uploaded));
target.add(uploadForm);
- } catch (Exception e) {
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
error(getString(Constants.ERROR) + ": " + e.getMessage());
((BasePage) getPage()).getFeedbackPanel().refresh(target);
LOG.error("While saving uploaded file", e);
@@ -198,7 +199,7 @@ public class BinaryFieldPanel extends FieldPanel<String> {
if (panelPreview != null) {
changePreviewer(panelPreview);
}
- } catch (Exception e) {
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
LOG.error("While loading saved file", e);
}
downloadLink.setEnabled(StringUtils.isNotBlank(model.getObject()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.java
index 3370cd7..3d923c6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.java
@@ -67,8 +67,8 @@ public class SpinnerFieldPanel<T extends Number> extends FieldPanel<T> {
}
private void init(final String name, final Class<T> reference, final IModel<T> model, final SpinnerConfig conf) {
- final Spinner<T> spinner = new Spinner<>("spinner", model, conf);
- add(spinner);
+ field = new Spinner<>("spinner", model, conf);
+ add(field);
this.name = name;
this.model = model;
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
index caa3857..1a1cdc5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizard.java
@@ -16,6 +16,7 @@
package org.apache.syncope.client.console.wizards;
import java.io.Serializable;
+import org.apache.syncope.client.console.panels.ModalPanel;
import org.apache.syncope.client.console.panels.NotificationPanel;
import org.apache.wicket.Component;
import org.apache.wicket.PageReference;
@@ -23,13 +24,18 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.wizard.Wizard;
import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.request.cycle.RequestCycle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public abstract class AjaxWizard<T extends Serializable> extends Wizard {
+public abstract class AjaxWizard<T extends Serializable> extends Wizard implements ModalPanel {
private static final long serialVersionUID = 1L;
+ protected static final Logger LOG = LoggerFactory.getLogger(AjaxWizard.class);
+
private final PageReference pageRef;
private T item;
@@ -87,9 +93,15 @@ public abstract class AjaxWizard<T extends Serializable> extends Wizard {
*/
@Override
public final void onCancel() {
- onCancelInternal();
- send(pageRef.getPage(), Broadcast.DEPTH,
- new NewItemCancelEvent<T>(item, RequestCycle.get().find(AjaxRequestTarget.class)));
+ final AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
+ try {
+ onCancelInternal();
+ send(pageRef.getPage(), Broadcast.DEPTH, new NewItemCancelEvent<T>(item, target));
+ } catch (Exception e) {
+ LOG.warn("Wizard error on cancel", e);
+ error(getString("wizard.cancel.error"));
+ feedbackPanel.refresh(target);
+ }
}
/**
@@ -97,9 +109,15 @@ public abstract class AjaxWizard<T extends Serializable> extends Wizard {
*/
@Override
public final void onFinish() {
- onApplyInternal();
- send(pageRef.getPage(), Broadcast.DEPTH,
- new NewItemFinishEvent<T>(item, RequestCycle.get().find(AjaxRequestTarget.class)));
+ final AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class);
+ try {
+ onApplyInternal();
+ send(pageRef.getPage(), Broadcast.DEPTH, new NewItemFinishEvent<T>(item, target));
+ } catch (Exception e) {
+ LOG.warn("Wizard error on finish", e);
+ error(getString("wizard.apply.error"));
+ feedbackPanel.refresh(target);
+ }
}
public T getItem() {
@@ -171,4 +189,14 @@ public abstract class AjaxWizard<T extends Serializable> extends Wizard {
}
}
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ onApplyInternal();
+ }
+
+ @Override
+ public void onError(final AjaxRequestTarget target, final Form<?> form) {
+ feedbackPanel.refresh(target);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
index 035eab6..7c778e7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardBuilder.java
@@ -28,7 +28,7 @@ public abstract class AjaxWizardBuilder<T extends Serializable> {
private final PageReference pageRef;
- private final T defaultItem;
+ private T defaultItem;
private T item;
@@ -55,7 +55,7 @@ public abstract class AjaxWizardBuilder<T extends Serializable> {
public AjaxWizard<T> build(final boolean edit) {
final T modelObject = getItem();
- setItem(null);
+ this.item = null;
return new AjaxWizard<T>(id, modelObject, buildModelSteps(modelObject, new WizardModel()), pageRef, edit) {
@@ -63,34 +63,39 @@ public abstract class AjaxWizardBuilder<T extends Serializable> {
@Override
protected void onCancelInternal() {
- AjaxWizardBuilder.this.onCancelInternal();
+ AjaxWizardBuilder.this.onCancelInternal(getItem());
}
@Override
protected void onApplyInternal() {
- AjaxWizardBuilder.this.onApplyInternal();
+ AjaxWizardBuilder.this.onApplyInternal(getItem());
}
};
}
protected abstract WizardModel buildModelSteps(final T modelObject, final WizardModel wizardModel);
- protected abstract void onCancelInternal();
+ protected abstract void onCancelInternal(T modelObject);
- protected abstract void onApplyInternal();
+ protected abstract void onApplyInternal(T modelObject);
+
+ protected T getDefaultItem() {
+ return defaultItem;
+ }
private T getItem() {
return item == null ? SerializationUtils.clone(defaultItem) : item;
}
/**
- * Replaces the default value provided with the constructor.
+ * Replaces the default value provided with the constructor and nullify working item object.
*
* @param item new value.
* @return the current wizard factory instance.
*/
public AjaxWizardBuilder<T> setItem(final T item) {
- this.item = item;
+ this.defaultItem = item;
+ this.item = null;
return this;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardButtonBar.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardButtonBar.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardButtonBar.java
index b272ff8..7ceb2fd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardButtonBar.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardButtonBar.java
@@ -71,6 +71,7 @@ public class AjaxWizardButtonBar extends WizardButtonBar {
@Override
protected void onClick(final AjaxRequestTarget target, final Form<?> form) {
getWizardModel().previous();
+ wizard.modelChanged();
target.add(wizard);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
new file mode 100644
index 0000000..1e02025
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
@@ -0,0 +1,216 @@
+/*
+ * 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.wizards;
+
+import java.io.Serializable;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.panels.NotificationPanel;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.event.IEventSource;
+import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
+
+public abstract class WizardMgtPanel<T extends Serializable> extends Panel implements IEventSource {
+
+ private static final long serialVersionUID = 1L;
+
+ private final WebMarkupContainer container;
+
+ private final Fragment initialFragment;
+
+ private final AjaxLink<?> addAjaxLink;
+
+ private AjaxWizardBuilder<T> newItemPanelBuilder;
+
+ private NotificationPanel notificationPanel;
+
+ private final PageReference pageRef;
+
+ /**
+ * Modal window.
+ */
+ protected final BaseModal<T> modal = new BaseModal<T>("modal") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+ setFooterVisible(false);
+ }
+
+ };
+
+ private final boolean wizardInModal;
+
+ public WizardMgtPanel(final String id, final PageReference pageRef) {
+ this(id, pageRef, false);
+ }
+
+ public WizardMgtPanel(final String id, final PageReference pageRef, final boolean wizardInModal) {
+ super(id);
+ setOutputMarkupId(true);
+ this.pageRef = pageRef;
+ this.wizardInModal = wizardInModal;
+
+ add(modal);
+
+ container = new TransparentWebMarkupContainer("container");
+ container.setOutputMarkupPlaceholderTag(true).setOutputMarkupId(true);
+ add(container);
+
+ initialFragment = new Fragment("content", "default", this);
+ container.addOrReplace(initialFragment);
+
+ addAjaxLink = new AjaxLink<T>("add") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ send(WizardMgtPanel.this, Broadcast.BREADTH, new AjaxWizard.NewItemActionEvent<T>(null, target));
+ }
+ };
+
+ addAjaxLink.setEnabled(false);
+ addAjaxLink.setVisible(false);
+ initialFragment.add(addAjaxLink);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void onEvent(final IEvent<?> event) {
+ if (event.getPayload() instanceof AjaxWizard.NewItemEvent) {
+ final AjaxRequestTarget target = AjaxWizard.NewItemEvent.class.cast(event.getPayload()).getTarget();
+
+ final T item = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getItem();
+
+ if (event.getPayload() instanceof AjaxWizard.NewItemActionEvent) {
+ if (item != null) {
+ newItemPanelBuilder.setItem(item);
+ }
+
+ final AjaxWizard<T> wizard = newItemPanelBuilder.build(
+ ((AjaxWizard.NewItemActionEvent<T>) event.getPayload()).getIndex());
+
+ if (wizardInModal) {
+ final IModel<T> model = new CompoundPropertyModel<>(item);
+ modal.setFormModel(model);
+
+ target.add(modal.setContent(wizard));
+
+ modal.header(new ResourceModel("item.new", "New item"));
+ modal.show(true);
+ } else {
+ final Fragment fragment = new Fragment("content", "wizard", WizardMgtPanel.this);
+ fragment.add(wizard);
+ container.addOrReplace(fragment);
+ }
+ } else {
+ if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) {
+ if (notificationPanel != null) {
+ getSession().info(getString(Constants.OPERATION_SUCCEEDED));
+ notificationPanel.refresh(target);
+ }
+ }
+
+ if (wizardInModal) {
+ modal.show(false);
+ modal.close(target);
+ } else {
+ container.addOrReplace(initialFragment);
+ }
+ }
+
+ target.add(container);
+ }
+ super.onEvent(event);
+ }
+
+ private WizardMgtPanel<T> addNewItemPanelBuilder(final AjaxWizardBuilder<T> panelBuilder) {
+ this.newItemPanelBuilder = panelBuilder;
+
+ if (this.newItemPanelBuilder != null) {
+ addAjaxLink.setEnabled(true);
+ addAjaxLink.setVisible(true);
+ }
+
+ return this;
+ }
+
+ private WizardMgtPanel<T> addNotificationPanel(final NotificationPanel notificationPanel) {
+ this.notificationPanel = notificationPanel;
+ return this;
+ }
+
+ /**
+ * PanelInWizard abstract builder.
+ *
+ * @param <T> list item reference type.
+ */
+ public abstract static class Builder<T extends Serializable> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final PageReference pageRef;
+
+ protected final Class<T> reference;
+
+ private AjaxWizardBuilder<T> newItemPanelBuilder;
+
+ private NotificationPanel notificationPanel;
+
+ protected Builder(final Class<T> reference, final PageReference pageRef) {
+ this.pageRef = pageRef;
+ this.reference = reference;
+ }
+
+ protected abstract WizardMgtPanel<T> newInstance(final String id);
+
+ /**
+ * Builds a list view.
+ *
+ * @param id component id.
+ * @return List view.
+ */
+ public WizardMgtPanel<T> build(final String id) {
+ return newInstance(id).addNewItemPanelBuilder(newItemPanelBuilder).addNotificationPanel(notificationPanel);
+ }
+
+ public Builder<T> addNewItemPanelBuilder(final AjaxWizardBuilder<T> panelBuilder) {
+ this.newItemPanelBuilder = panelBuilder;
+ return this;
+ }
+
+ public Builder<T> addNotificationPanel(final NotificationPanel notificationPanel) {
+ this.notificationPanel = notificationPanel;
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectWizardBuilder.java
new file mode 100644
index 0000000..62707cc
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectWizardBuilder.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.wizards.any;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.StringResourceModel;
+
+public class AnyObjectWizardBuilder extends AjaxWizardBuilder<AnyTO> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final AnyTO anyTO;
+
+ private final LoadableDetachableModel<List<String>> anyTypes = new LoadableDetachableModel<List<String>>() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected List<String> load() {
+ final List<String> currentlyAdded = new ArrayList<>();
+ return currentlyAdded;
+ }
+ };
+
+ /**
+ * The object type specification step.
+ */
+ private final class ObjectType extends WizardStep {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ */
+ ObjectType(final AnyTO item) {
+ super(new ResourceModel("type.title", StringUtils.EMPTY),
+ new ResourceModel("type.summary", StringUtils.EMPTY), new Model<AnyTO>(item));
+
+ add(new AjaxDropDownChoicePanel<String>("type", "type", new PropertyModel<String>(item, "anyType"), false).
+ setChoices(anyTypes).
+ setStyleSheet("form-control").
+ setRequired(true));
+
+ add(new TextField<String>(
+ "class", new PropertyModel<String>(item, "objectClass")).setRequired(true));
+ }
+ }
+
+ /**
+ * Mapping definition step.
+ */
+ private final class Mapping extends WizardStep {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ */
+ Mapping(final AnyTO item) {
+ setTitleModel(new ResourceModel("mapping.title", "Mapping"));
+ setSummaryModel(new StringResourceModel("mapping.summary", this, new Model<AnyTO>(item)));
+ }
+ }
+
+ /**
+ * AccountLink specification step.
+ */
+ private final class ConnObjectLink extends WizardStep {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ */
+ ConnObjectLink(final AnyTO item) {
+ super(new ResourceModel("link.title", StringUtils.EMPTY),
+ new ResourceModel("link.summary", StringUtils.EMPTY));
+
+ final WebMarkupContainer connObjectLinkContainer = new WebMarkupContainer("connObjectLinkContainer");
+ connObjectLinkContainer.setOutputMarkupId(true);
+ add(connObjectLinkContainer);
+ }
+ }
+
+ /**
+ * Construct.
+ *
+ * @param id The component id
+ * @param anyTO external resource to be updated.
+ * @param pageRef Caller page reference.
+ */
+ public AnyObjectWizardBuilder(final String id, final AnyTO anyTO, final PageReference pageRef) {
+ super(id, new AnyObjectTO(), pageRef);
+ this.anyTO = anyTO;
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final AnyTO modelObject, final WizardModel wizardModel) {
+ wizardModel.add(new ObjectType(modelObject));
+ wizardModel.add(new Mapping(modelObject));
+ wizardModel.add(new ConnObjectLink(modelObject));
+ return wizardModel;
+ }
+
+ @Override
+ protected void onCancelInternal(final AnyTO modelObject) {
+ // d nothing
+ }
+
+ @Override
+ protected void onApplyInternal(final AnyTO modelObject) {
+ // do nothing
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java
new file mode 100644
index 0000000..c46f135
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.wizards.any;
+
+import java.io.Serializable;
+import java.util.List;
+import org.apache.syncope.client.console.commons.Mode;
+import org.apache.syncope.client.console.rest.AnyTypeRestClient;
+import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
+import org.apache.syncope.common.lib.AnyOperations;
+import org.apache.syncope.common.lib.patch.AnyObjectPatch;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+
+public class AnyWizardBuilder<T extends AnyTO> extends AjaxWizardBuilder<T> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final AnyTypeRestClient anyTypeRestClient = new AnyTypeRestClient();
+
+ protected final List<String> anyTypeClasses;
+
+ /**
+ * Construct.
+ *
+ * @param id The component id
+ * @param anyTO any
+ * @param anyTypeClasses
+ * @param pageRef Caller page reference.
+ */
+ public AnyWizardBuilder(
+ final String id, final T anyTO, final List<String> anyTypeClasses, final PageReference pageRef) {
+ super(id, anyTO, pageRef);
+ this.anyTypeClasses = anyTypeClasses;
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final T modelObject, final WizardModel wizardModel) {
+ wizardModel.add(new PlainAttrs(modelObject, null, Mode.ADMIN, anyTypeClasses.toArray(new String[] {})));
+ wizardModel.add(new DerAttrs(modelObject, anyTypeClasses.toArray(new String[] {})));
+ wizardModel.add(new VirAttrs(modelObject, anyTypeClasses.toArray(new String[] {})));
+ return wizardModel;
+ }
+
+ @Override
+ protected void onCancelInternal(final T modelObject) {
+ // do nothing
+ }
+
+ @Override
+ protected void onApplyInternal(final T modelObject) {
+ if (!(modelObject instanceof AnyObjectTO)) {
+ throw new IllegalArgumentException();
+ }
+
+ final ProvisioningResult<AnyObjectTO> actual;
+
+ if (modelObject.getKey() == 0) {
+ actual = anyTypeRestClient.create(AnyObjectTO.class.cast(modelObject));
+ } else {
+ final AnyObjectPatch patch = AnyOperations.diff(modelObject, getDefaultItem(), true);
+
+ // update user just if it is changed
+ if (!patch.isEmpty()) {
+ actual = anyTypeRestClient.update(getDefaultItem().getETagValue(), patch);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/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
new file mode 100644
index 0000000..42af808
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java
@@ -0,0 +1,137 @@
+/*
+ * 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.wizards.any;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+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.types.SchemaType;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+
+public class DerAttrs extends WizardStep {
+
+ private static final long serialVersionUID = -5387344116983102292L;
+
+ private final SchemaRestClient schemaRestClient = new SchemaRestClient();
+
+ public <T extends AnyTO> DerAttrs(final T entityTO, final String... anyTypeClass) {
+
+ setOutputMarkupId(true);
+
+ final IModel<List<String>> derSchemas = new LoadableDetachableModel<List<String>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ List<DerSchemaTO> derSchemaNames = schemaRestClient.getSchemas(SchemaType.DERIVED, anyTypeClass);
+
+ return new ArrayList<>(CollectionUtils.collect(derSchemaNames, new Transformer<DerSchemaTO, String>() {
+
+ @Override
+ public String transform(final DerSchemaTO input) {
+ return input.getKey();
+ }
+ }));
+ }
+ };
+
+ final Map<String, AttrTO> derAttrMap = entityTO.getDerAttrMap();
+ CollectionUtils.collect(derSchemas.getObject(), new Transformer<String, AttrTO>() {
+
+ @Override
+ public AttrTO transform(final String input) {
+ AttrTO attrTO = derAttrMap.get(input);
+ if (attrTO == null) {
+ attrTO = new AttrTO();
+ attrTO.setSchema(input);
+ }
+ return attrTO;
+ }
+ }, entityTO.getDerAttrs());
+
+ final Fragment fragment;
+ if (entityTO.getDerAttrs().isEmpty()) {
+ // show empty list message
+ fragment = new Fragment("content", "empty", this);
+ } else {
+ fragment = new Fragment("content", "attributes", this);
+
+ final WebMarkupContainer attributesContainer = new WebMarkupContainer("derAttrContainer");
+ attributesContainer.setOutputMarkupId(true);
+ fragment.add(attributesContainer);
+
+ ListView<AttrTO> attributes = new ListView<AttrTO>("attrs",
+ new PropertyModel<List<AttrTO>>(entityTO, "derAttrs") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public List<AttrTO> getObject() {
+ return new ArrayList<>(entityTO.getDerAttrs());
+ }
+
+ }) {
+
+ private static final long serialVersionUID = 9101744072914090143L;
+
+ @Override
+ protected void populateItem(final ListItem<AttrTO> item) {
+ final AttrTO attrTO = item.getModelObject();
+
+ final IModel<String> model;
+ final List<String> values = attrTO.getValues();
+ if (values == null || values.isEmpty()) {
+ model = new ResourceModel("derived.emptyvalue.message", StringUtils.EMPTY);
+ } else {
+ model = new Model<String>(values.get(0));
+ }
+
+ final AjaxTextFieldPanel panel = new AjaxTextFieldPanel("panel", attrTO.getSchema(), model);
+
+ panel.setEnabled(false);
+ panel.setRequired(true);
+ panel.setOutputMarkupId(true);
+ item.add(panel);
+
+ }
+ };
+ attributesContainer.add(attributes);
+ }
+
+ add(fragment);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
new file mode 100644
index 0000000..63ff592
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
@@ -0,0 +1,293 @@
+/*
+ * 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.wizards.any;
+
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GroupDetails extends WizardStep {
+
+ private static final long serialVersionUID = 855618618337931784L;
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(GroupDetails.class);
+
+ private final UserRestClient userRestClient = new UserRestClient();
+
+ private final GroupRestClient groupRestClient = new GroupRestClient();
+
+ private final WebMarkupContainer ownerContainer;
+
+ private final OwnerModel userOwnerModel;
+
+ private final OwnerModel groupOwnerModel;
+
+ public GroupDetails(final GroupTO groupTO, final boolean templateMode) {
+ ownerContainer = new WebMarkupContainer("ownerContainer");
+ ownerContainer.setOutputMarkupId(true);
+ this.add(ownerContainer);
+
+ final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
+ userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
+ this.add(userOwnerSelectWin);
+ final ModalWindow groupOwnerSelectWin = new ModalWindow("groupOwnerSelectWin");
+ groupOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ groupOwnerSelectWin.setCookieName("create-groupOwnerSelect-modal");
+ this.add(groupOwnerSelectWin);
+
+ final AjaxTextFieldPanel name
+ = new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(groupTO, "name"));
+
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
+
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ this.add(questionMarkJexlHelp);
+ questionMarkJexlHelp.add(jexlHelp);
+
+ if (!templateMode) {
+ name.addRequiredLabel();
+ questionMarkJexlHelp.setVisible(false);
+ }
+ this.add(name);
+
+ userOwnerModel = new OwnerModel(groupTO, AnyTypeKind.USER);
+ @SuppressWarnings("unchecked")
+ final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
+ userOwner.setReadOnly(true);
+ userOwner.setOutputMarkupId(true);
+ ownerContainer.add(userOwner);
+ final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+// return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
+ return null;
+ }
+ });
+ userOwnerSelectWin.show(target);
+ }
+ };
+ ownerContainer.add(userOwnerSelect.setEnabled(false));
+ final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerModel.setObject(null);
+ target.add(userOwner);
+ }
+ };
+ ownerContainer.add(userOwnerReset.setEnabled(false));
+
+ groupOwnerModel = new OwnerModel(groupTO, AnyTypeKind.GROUP);
+ @SuppressWarnings("unchecked")
+ final AjaxTextFieldPanel groupOwner = new AjaxTextFieldPanel("groupOwner", "groupOwner", groupOwnerModel);
+ groupOwner.setReadOnly(true);
+ groupOwner.setOutputMarkupId(true);
+ ownerContainer.add(groupOwner);
+ final AjaxLink<Void> groupOwnerSelect = new IndicatingAjaxLink<Void>("groupOwnerSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+// return new GroupSelectModalPage(getPage().getPageReference(), userOwnerSelectWin,
+// GroupOwnerSelectPayload.class);
+ return null;
+ }
+ });
+ userOwnerSelectWin.show(target);
+ }
+ };
+ ownerContainer.add(groupOwnerSelect.setEnabled(false));
+ final IndicatingAjaxLink<Void> groupOwnerReset = new IndicatingAjaxLink<Void>("groupOwnerReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ groupOwnerModel.setObject(null);
+ target.add(groupOwner);
+ }
+ };
+ ownerContainer.add(groupOwnerReset.setEnabled(false));
+ }
+
+ /**
+ * This is waiting for events from opened modal windows: first to get the selected user / group, then to update the
+ * respective text panel.
+ *
+ * {@inheritDoc }
+ *
+ * @param event
+ */
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof UserOwnerSelectPayload) {
+ userOwnerModel.setObject(((UserOwnerSelectPayload) event.getPayload()).getUserId());
+ }
+ if (event.getPayload() instanceof GroupOwnerSelectPayload) {
+ groupOwnerModel.setObject(((GroupOwnerSelectPayload) event.getPayload()).getGroupId());
+ }
+
+ if (event.getPayload() instanceof AjaxRequestTarget) {
+ ((AjaxRequestTarget) event.getPayload()).add(ownerContainer);
+ }
+ }
+
+ private class OwnerModel implements IModel {
+
+ private static final long serialVersionUID = -3865621970810102714L;
+
+ private final GroupTO groupTO;
+
+ private final AnyTypeKind type;
+
+ OwnerModel(final GroupTO groupTO, final AnyTypeKind type) {
+ this.groupTO = groupTO;
+ this.type = type;
+ }
+
+ @Override
+ public Object getObject() {
+ String object = null;
+
+ switch (type) {
+ case USER:
+ if (groupTO.getUserOwner() != null) {
+ UserTO user = null;
+ try {
+ user = userRestClient.read(groupTO.getUserOwner());
+ } catch (Exception e) {
+ LOG.warn("Could not find user with id {}, ignoring", groupTO.getUserOwner(), e);
+ }
+ if (user == null) {
+ groupTO.setUserOwner(null);
+ } else {
+ object = user.getKey() + " " + user.getUsername();
+ }
+ }
+ break;
+
+ case GROUP:
+ GroupTO group = null;
+ if (groupTO.getGroupOwner() != null) {
+ try {
+ group = groupRestClient.read(groupTO.getGroupOwner());
+ } catch (Exception e) {
+ LOG.warn("Could not find group with id {}, ignoring", groupTO.getGroupOwner(), e);
+ }
+ if (group == null) {
+ groupTO.setGroupOwner(null);
+ } else {
+ object = group.getDisplayName();
+ }
+ }
+ break;
+
+ default:
+ }
+
+ return object;
+ }
+
+ @Override
+ public void setObject(final Object object) {
+ switch (type) {
+ case USER:
+ groupTO.setUserOwner((Long) object);
+ break;
+
+ case GROUP:
+ groupTO.setGroupOwner((Long) object);
+ break;
+
+ default:
+ }
+ }
+
+ @Override
+ public void detach() {
+ // ignore
+ }
+ }
+
+ public static class UserOwnerSelectPayload {
+
+ private final Long userId;
+
+ public UserOwnerSelectPayload(final Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+ }
+
+ public static class GroupOwnerSelectPayload {
+
+ private final Long groupId;
+
+ public GroupOwnerSelectPayload(final Long groupId) {
+ this.groupId = groupId;
+ }
+
+ public Long getGroupId() {
+ return groupId;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java
new file mode 100644
index 0000000..9ae9332
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupWizardBuilder.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.wizards.any;
+
+import java.util.List;
+import org.apache.syncope.client.console.rest.GroupRestClient;
+import org.apache.syncope.common.lib.AnyOperations;
+import org.apache.syncope.common.lib.patch.GroupPatch;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+
+public class GroupWizardBuilder extends AnyWizardBuilder<GroupTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final GroupRestClient groupRestClient = new GroupRestClient();
+
+ /**
+ * Construct.
+ *
+ * @param id The component id
+ * @param groupTO any
+ * @param anyTypeClasses
+ * @param pageRef Caller page reference.
+ */
+ public GroupWizardBuilder(
+ final String id, final GroupTO groupTO, final List<String> anyTypeClasses, final PageReference pageRef) {
+ super(id, groupTO, anyTypeClasses, pageRef);
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final GroupTO modelObject, final WizardModel wizardModel) {
+ wizardModel.add(new GroupDetails(modelObject, false));
+ return super.buildModelSteps(modelObject, wizardModel);
+ }
+
+ @Override
+ protected void onApplyInternal(final GroupTO modelObject) {
+ final ProvisioningResult<GroupTO> actual;
+
+ if (modelObject.getKey() == 0) {
+ actual = groupRestClient.create(modelObject);
+ } else {
+ final GroupPatch patch = AnyOperations.diff(modelObject, getDefaultItem(), true);
+
+ // update user just if it is changed
+ if (!patch.isEmpty()) {
+ actual = groupRestClient.update(getDefaultItem().getETagValue(), patch);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/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
new file mode 100644
index 0000000..4501856
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.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.client.console.wizards.any;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
+import org.apache.syncope.client.console.commons.Mode;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.BinaryFieldPanel;
+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.wicket.markup.html.form.SpinnerFieldPanel;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.IChoiceRenderer;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+public class PlainAttrs extends WizardStep {
+
+ private static final long serialVersionUID = 552437609667518888L;
+
+ private final SchemaRestClient schemaRestClient = new SchemaRestClient();
+
+ private final AnyTO entityTO;
+
+ private final Mode mode;
+
+ private Map<String, PlainSchemaTO> schemas = new LinkedHashMap<>();
+
+ private final String[] anyTypeClass;
+
+ public <T extends AnyTO> PlainAttrs(final T entityTO, final Form<?> form, final Mode mode,
+ final String... anyTypeClass) {
+ this.setOutputMarkupId(true);
+
+ this.entityTO = entityTO;
+ this.mode = mode;
+ this.anyTypeClass = anyTypeClass;
+
+ setSchemas();
+ setAttrs();
+
+ add(new ListView<AttrTO>("schemas", new PropertyModel<List<AttrTO>>(entityTO, "plainAttrs") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public List<AttrTO> getObject() {
+ return new ArrayList<>(super.getObject());
+ }
+
+ }) {
+
+ private static final long serialVersionUID = 9101744072914090143L;
+
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected void populateItem(final ListItem<AttrTO> item) {
+ final AttrTO attributeTO = (AttrTO) item.getDefaultModelObject();
+
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("jexlHelp");
+
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ item.add(questionMarkJexlHelp);
+ questionMarkJexlHelp.add(jexlHelp);
+
+ if (mode != Mode.TEMPLATE) {
+ questionMarkJexlHelp.setVisible(false);
+ }
+
+ final FieldPanel panel = getFieldPanel(schemas.get(attributeTO.getSchema()), form, attributeTO);
+
+ if (mode == Mode.TEMPLATE || !schemas.get(attributeTO.getSchema()).isMultivalue()) {
+ item.add(panel);
+ } else {
+ item.add(new MultiFieldPanel<String>(
+ "panel", attributeTO.getSchema(), new PropertyModel<List<String>>(attributeTO, "values"),
+ panel));
+ }
+ }
+ }
+ );
+ }
+
+ private void setSchemas() {
+
+ AttrTO attrLayout = null;
+ final List<PlainSchemaTO> schemaTOs = schemaRestClient.getSchemas(SchemaType.PLAIN, anyTypeClass);
+
+ schemas.clear();
+
+ if (attrLayout != null && mode != Mode.TEMPLATE) {
+ // 1. remove attributes not selected for display
+ schemaRestClient.filter(schemaTOs, attrLayout.getValues(), true);
+ // 2. sort remainig attributes according to configuration, e.g. attrLayout
+ final Map<String, Integer> attrLayoutMap = new HashMap<>(attrLayout.getValues().size());
+ for (int i = 0; i < attrLayout.getValues().size(); i++) {
+ attrLayoutMap.put(attrLayout.getValues().get(i), i);
+ }
+ Collections.sort(schemaTOs, new Comparator<PlainSchemaTO>() {
+
+ @Override
+ public int compare(final PlainSchemaTO schema1, final PlainSchemaTO schema2) {
+ int value = 0;
+
+ if (attrLayoutMap.get(schema1.getKey()) > attrLayoutMap.get(schema2.getKey())) {
+ value = 1;
+ } else if (attrLayoutMap.get(schema1.getKey()) < attrLayoutMap.get(schema2.getKey())) {
+ value = -1;
+ }
+
+ return value;
+ }
+ });
+ }
+ for (PlainSchemaTO schemaTO : schemaTOs) {
+ schemas.put(schemaTO.getKey(), schemaTO);
+ }
+ }
+
+ private void setAttrs() {
+ final List<AttrTO> entityData = new ArrayList<>();
+
+ final Map<String, AttrTO> attrMap = entityTO.getPlainAttrMap();
+
+ for (PlainSchemaTO schema : schemas.values()) {
+ final AttrTO attributeTO = new AttrTO();
+ attributeTO.setSchema(schema.getKey());
+
+ if (attrMap.get(schema.getKey()) == null || attrMap.get(schema.getKey()).getValues().isEmpty()) {
+ attributeTO.getValues().add("");
+
+ // is important to set readonly only after values setting
+ attributeTO.setReadonly(schema.isReadonly());
+ } else {
+ attributeTO.getValues().addAll(attrMap.get(schema.getKey()).getValues());
+ }
+ entityData.add(attributeTO);
+ }
+
+ entityTO.getPlainAttrs().clear();
+ entityTO.getPlainAttrs().addAll(entityData);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private FieldPanel getFieldPanel(final PlainSchemaTO schemaTO, final Form form, final AttrTO attributeTO) {
+ final boolean required = mode == Mode.TEMPLATE
+ ? false
+ : schemaTO.getMandatoryCondition().equalsIgnoreCase("true");
+
+ final boolean readOnly = mode == Mode.TEMPLATE ? false : schemaTO.isReadonly();
+
+ final AttrSchemaType type = mode == Mode.TEMPLATE ? AttrSchemaType.String : schemaTO.getType();
+
+ final FieldPanel panel;
+ switch (type) {
+ case Boolean:
+ panel = new AjaxCheckBoxPanel("panel", schemaTO.getKey(), new Model<Boolean>(), false);
+ panel.setRequired(required);
+ break;
+
+// case Date:
+// final String dataPattern = schemaTO.getConversionPattern() == null
+// ? SyncopeConstants.DEFAULT_DATE_PATTERN
+// : schemaTO.getConversionPattern();
+//
+// if (dataPattern.contains("H")) {
+// panel = new DateTimeFieldPanel("panel", schemaTO.getKey(), new Model<Date>(), dataPattern);
+//
+// if (required) {
+// panel.addRequiredLabel();
+// ((DateTimeFieldPanel) panel).setFormValidator(form);
+// }
+// panel.setStyleSheet("ui-widget-content ui-corner-all");
+// } else {
+// panel = new DateTextFieldPanel("panel", schemaTO.getKey(), new Model<Date>(), dataPattern);
+//
+// if (required) {
+// panel.addRequiredLabel();
+// }
+// }
+// break;
+ case Enum:
+ panel = new AjaxDropDownChoicePanel<String>("panel", schemaTO.getKey(), new Model<String>());
+ ((AjaxDropDownChoicePanel<String>) panel).setChoices(getEnumeratedValues(schemaTO));
+
+ if (StringUtils.isNotBlank(schemaTO.getEnumerationKeys())) {
+ ((AjaxDropDownChoicePanel) panel).setChoiceRenderer(new IChoiceRenderer<String>() {
+
+ private static final long serialVersionUID = -3724971416312135885L;
+
+ private final Map<String, String> valueMap = getEnumeratedKeyValues(schemaTO);
+
+ @Override
+ public String getDisplayValue(final String value) {
+ return valueMap.get(value) == null ? value : valueMap.get(value);
+ }
+
+ @Override
+ public String getIdValue(final String value, final int i) {
+ return value;
+ }
+
+ @Override
+ public String getObject(
+ final String id, final IModel<? extends List<? extends String>> choices) {
+ return id;
+ }
+ });
+ }
+
+ if (required) {
+ panel.addRequiredLabel();
+ }
+ break;
+
+ case Long:
+ panel = new SpinnerFieldPanel<Long>("panel", schemaTO.getKey(), Long.class, new Model<Long>());
+
+ if (required) {
+ panel.addRequiredLabel();
+ }
+ break;
+
+ case Double:
+ panel = new SpinnerFieldPanel<Double>("panel", schemaTO.getKey(), Double.class, new Model<Double>());
+
+ if (required) {
+ panel.addRequiredLabel();
+ }
+ break;
+
+ case Binary:
+ panel = new BinaryFieldPanel("panel", schemaTO.getKey(), new Model<String>(),
+ schemas.containsKey(schemaTO.getKey())
+ ? schemas.get(schemaTO.getKey()).getMimeType()
+ : null);
+
+ if (required) {
+ panel.addRequiredLabel();
+ }
+ break;
+
+ default:
+ panel = new AjaxTextFieldPanel("panel", schemaTO.getKey(), new Model<String>(), false);
+
+ if (required) {
+ panel.addRequiredLabel();
+ }
+ }
+
+ panel.setReadOnly(readOnly);
+ panel.setNewModel(attributeTO.getValues());
+
+ return panel;
+ }
+
+ private Map<String, String> getEnumeratedKeyValues(final PlainSchemaTO schemaTO) {
+ final Map<String, String> res = new HashMap<>();
+
+ final String[] values = StringUtils.isBlank(schemaTO.getEnumerationValues())
+ ? new String[0]
+ : schemaTO.getEnumerationValues().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
+
+ final String[] keys = StringUtils.isBlank(schemaTO.getEnumerationKeys())
+ ? new String[0]
+ : schemaTO.getEnumerationKeys().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
+
+ for (int i = 0; i < values.length; i++) {
+ res.put(values[i].trim(), keys.length > i ? keys[i].trim() : null);
+ }
+
+ return res;
+ }
+
+ private List<String> getEnumeratedValues(final PlainSchemaTO schemaTO) {
+ final List<String> res = new ArrayList<>();
+
+ final String[] values = StringUtils.isBlank(schemaTO.getEnumerationValues())
+ ? new String[0]
+ : schemaTO.getEnumerationValues().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
+
+ for (String value : values) {
+ res.add(value.trim());
+ }
+
+ return res;
+ }
+
+// @Override
+// public void onEvent(final IEvent<?> event) {
+// if ((event.getPayload() instanceof GroupAttrTemplatesChange)) {
+// final GroupAttrTemplatesChange update = (GroupAttrTemplatesChange) event.getPayload();
+// if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.gPlainAttrTemplates) {
+// setSchemas();
+// setAttrs();
+// update.getTarget().add(this);
+// }
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
new file mode 100644
index 0000000..5918fd0
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
@@ -0,0 +1,104 @@
+/*
+ * 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.wizards.any;
+
+import org.apache.syncope.client.console.commons.JexlHelpUtils;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+public class UserDetails extends WizardStep {
+
+ private static final long serialVersionUID = 6592027822510220463L;
+
+ public UserDetails(final UserTO userTO, final boolean resetPassword, final boolean templateMode) {
+ // ------------------------
+ // Username
+ // ------------------------
+ final FieldPanel<String> username = new AjaxTextFieldPanel("username", "username",
+ new PropertyModel<String>(userTO, "username"));
+
+ final WebMarkupContainer jexlHelp = JexlHelpUtils.getJexlHelpWebContainer("usernameJexlHelp");
+
+ final AjaxLink<?> questionMarkJexlHelp = JexlHelpUtils.getAjaxLink(jexlHelp, "usernameQuestionMarkJexlHelp");
+ add(questionMarkJexlHelp);
+ questionMarkJexlHelp.add(jexlHelp);
+
+ if (!templateMode) {
+ username.addRequiredLabel();
+ questionMarkJexlHelp.setVisible(false);
+ }
+ add(username);
+ // ------------------------
+
+ // ------------------------
+ // Password
+ // ------------------------
+ final Form<?> form = new Form<>("passwordInnerForm");
+ add(form);
+
+ final WebMarkupContainer pwdJexlHelp = JexlHelpUtils.getJexlHelpWebContainer("pwdJexlHelp");
+
+ final AjaxLink<?> pwdQuestionMarkJexlHelp = JexlHelpUtils.getAjaxLink(pwdJexlHelp, "pwdQuestionMarkJexlHelp");
+ form.add(pwdQuestionMarkJexlHelp);
+ pwdQuestionMarkJexlHelp.add(pwdJexlHelp);
+
+ FieldPanel<String> passwordField
+ = new AjaxPasswordFieldPanel("password", "password", new PropertyModel<String>(userTO, "password"));
+ passwordField.setRequired(true);
+ passwordField.setMarkupId("password");
+ passwordField.setPlaceholder("password");
+ ((PasswordTextField) passwordField.getField()).setResetPassword(true);
+ form.add(passwordField);
+
+ FieldPanel<String> confirmPasswordField
+ = new AjaxPasswordFieldPanel("confirmPassword", "confirmPassword", new Model<String>());
+ confirmPasswordField.setRequired(true);
+ confirmPasswordField.setMarkupId("confirmPassword");
+ confirmPasswordField.setPlaceholder("confirmPassword");
+ ((PasswordTextField) confirmPasswordField.getField()).setResetPassword(true);
+ form.add(confirmPasswordField);
+
+ form.add(new EqualPasswordInputValidator(passwordField.getField(), confirmPasswordField.getField()));
+
+ if (templateMode) {
+ confirmPasswordField.setEnabled(false);
+ confirmPasswordField.setVisible(false);
+ } else {
+ pwdQuestionMarkJexlHelp.setVisible(false);
+
+ ((PasswordTextField) passwordField.getField()).setResetPassword(resetPassword);
+
+ if (!resetPassword) {
+ confirmPasswordField.getField().setModelObject(userTO.getPassword());
+ }
+ ((PasswordTextField) confirmPasswordField.getField()).setResetPassword(resetPassword);
+ }
+ // ------------------------
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java
new file mode 100644
index 0000000..21d990f
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2015 The Apache Software Foundation.
+ *
+ * Licensed 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.wizards.any;
+
+import java.util.List;
+import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.common.lib.AnyOperations;
+import org.apache.syncope.common.lib.patch.UserPatch;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.model.Model;
+
+public class UserWizardBuilder extends AnyWizardBuilder<UserTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final UserRestClient userRestClient = new UserRestClient();
+
+ /**
+ * Construct.
+ *
+ * @param id The component id
+ * @param userTO any
+ * @param anyTypeClasses
+ * @param pageRef Caller page reference.
+ */
+ public UserWizardBuilder(
+ final String id, final UserTO userTO, final List<String> anyTypeClasses, final PageReference pageRef) {
+ super(id, userTO, anyTypeClasses, pageRef);
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final UserTO modelObject, final WizardModel wizardModel) {
+ wizardModel.add(new UserDetails(modelObject, false, false));
+ return super.buildModelSteps(modelObject, wizardModel);
+ }
+
+ @Override
+ protected void onApplyInternal(final UserTO modelObject) {
+ Model<Boolean> storePassword = new Model<>(true);
+
+ final ProvisioningResult<UserTO> actual;
+
+ if (modelObject.getKey() == 0) {
+ actual = userRestClient.create(modelObject, storePassword.getObject());
+ } else {
+ final UserPatch patch = AnyOperations.diff(modelObject, getDefaultItem(), true);
+
+// if (statusPanel != null) {
+// patch.setPwdPropRequest(statusPanel.getStatusMod());
+// }
+ // update user just if it is changed
+ if (!patch.isEmpty()) {
+ actual = userRestClient.update(getDefaultItem().getETagValue(), patch);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
new file mode 100644
index 0000000..3bfcc17
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
@@ -0,0 +1,141 @@
+/*
+ * 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.wizards.any;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+public class VirAttrs extends WizardStep {
+
+ private static final long serialVersionUID = -7982691107029848579L;
+
+ private SchemaRestClient schemaRestClient = new SchemaRestClient();
+
+ private final Map<String, VirSchemaTO> schemas = new TreeMap<String, VirSchemaTO>();
+
+ public <T extends AnyTO> VirAttrs(final T entityTO, final String... anyTypeClass) {
+ this.setOutputMarkupId(true);
+
+ final IModel<List<String>> virSchemas = new LoadableDetachableModel<List<String>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ List<VirSchemaTO> schemaTOs = schemaRestClient.getSchemas(SchemaType.VIRTUAL, anyTypeClass);
+
+ schemas.clear();
+
+ for (VirSchemaTO schemaTO : schemaTOs) {
+ schemas.put(schemaTO.getKey(), schemaTO);
+ }
+
+ return new ArrayList<>(schemas.keySet());
+ }
+ };
+
+ final Map<String, AttrTO> virAttrMap = entityTO.getVirAttrMap();
+ CollectionUtils.collect(virSchemas.getObject(), new Transformer<String, AttrTO>() {
+
+ @Override
+ public AttrTO transform(final String input) {
+ AttrTO attrTO = virAttrMap.get(input);
+ if (attrTO == null) {
+ attrTO = new AttrTO();
+ attrTO.setSchema(input);
+ attrTO.getValues().add(StringUtils.EMPTY);
+ } else if (attrTO.getValues().isEmpty()) {
+ attrTO.getValues().add("");
+ }
+
+ return attrTO;
+ }
+ }, entityTO.getVirAttrs());
+
+ final Fragment fragment;
+ if (entityTO.getVirAttrs().isEmpty()) {
+ // show empty list message
+ fragment = new Fragment("content", "empty", this);
+ } else {
+ fragment = new Fragment("content", "attributes", this);
+
+ final WebMarkupContainer attributesContainer = new WebMarkupContainer("virAttrContainer");
+ attributesContainer.setOutputMarkupId(true);
+ fragment.add(attributesContainer);
+
+ ListView<AttrTO> attributes = new ListView<AttrTO>("attrs",
+ new PropertyModel<List<AttrTO>>(entityTO, "virAttrs") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public List<AttrTO> getObject() {
+ return new ArrayList<>(entityTO.getVirAttrs());
+ }
+
+ }) {
+
+ private static final long serialVersionUID = 9101744072914090143L;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void populateItem(final ListItem<AttrTO> item) {
+ AttrTO attrTO = item.getModelObject();
+ final VirSchemaTO schema = schemas.get(attrTO.getSchema());
+
+ attrTO.setReadonly(schema.isReadonly());
+
+ final AjaxTextFieldPanel panel
+ = new AjaxTextFieldPanel("panel", attrTO.getSchema(), new Model<String>());
+
+ item.add(new MultiFieldPanel<String>(
+ "panel",
+ schema.getKey(),
+ new PropertyModel<List<String>>(attrTO, "values"),
+ panel).setEnabled(!schema.isReadonly()));
+ }
+ };
+
+ attributesContainer.add(attributes);
+ }
+
+ add(fragment);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
index 1172035..8c20920 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
@@ -107,8 +107,7 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> imple
setStyleSheet("form-control").
setRequired(true));
- add(new TextField<String>(
- "class", new PropertyModel<String>(item, "objectClass")).setRequired(true));
+ add(new TextField<String>("class", new PropertyModel<String>(item, "objectClass")).setRequired(true));
}
}
@@ -211,12 +210,12 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> imple
}
@Override
- protected void onCancelInternal() {
- // d nothing
+ protected void onCancelInternal(final ProvisionTO modelObject) {
+ // do nothing
}
@Override
- protected void onApplyInternal() {
+ protected void onApplyInternal(final ProvisionTO modelObject) {
// do nothing
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css b/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
index ad0f032..98bb267 100644
--- a/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
+++ b/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css
@@ -201,10 +201,25 @@ div.basepage-content{
overflow: hidden;
}
+.modal-body {
+ max-height: 600px;
+ overflow-y: auto;
+}
+
.modal {
background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
}
+.wizard-view {
+ max-height: 500px;
+ overflow: auto;
+ padding: 0px 15px 0px 5px;
+}
+
+.wizard-buttons {
+ padding: 10px 0px 5px 0px;
+}
+
div.realms div.summarize {
margin: 50px 100px;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.html
index 457ccc8..8a51c77 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.html
@@ -21,8 +21,8 @@ under the License.
<title>Search result panel</title>
</head>
<body>
- <wicket:panel>
- <div wicket:id="container">
+ <wicket:extend>
+ <div wicket:id="searchContainer">
<span wicket:id="resultTable">[Table]</span>
<span style="float:right">
@@ -38,10 +38,6 @@ under the License.
</form>
</span>
</div>
-
- <div wicket:id="modal">
- </div>
-
- </wicket:panel>
+ </wicket:extend>
</body>
</html>
[18/50] [abbrv] syncope git commit: Fixed SYNCOPE-595 and SYNCOPE-583,
SYNCOPE-158
Posted by fm...@apache.org.
Fixed SYNCOPE-595 and SYNCOPE-583, SYNCOPE-158
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3c36fe10
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3c36fe10
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3c36fe10
Branch: refs/heads/SYNCOPE-156
Commit: 3c36fe10e73bc14fb4512a88127d8b2d11919bee
Parents: 207d93c
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 28 17:21:15 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 28 17:21:15 2015 +0100
----------------------------------------------------------------------
.../entitlement/AbstractEntitlementCommand.java | 27 +++++
.../entitlement/EntitlementCommand.java | 121 +++++++++++++++++++
.../commands/entitlement/EntitlementList.java | 26 ++++
.../entitlement/EntitlementListRole.java | 62 ++++++++++
.../entitlement/EntitlementReadByUserId.java | 53 ++++++++
.../entitlement/EntitlementReadByUsername.java | 53 ++++++++
.../entitlement/EntitlementResultManager.java | 54 +++++++++
.../entitlement/EntitlementSearchByRole.java | 54 +++++++++
.../EntitlementSyncopeOperations.java | 74 ++++++++++++
.../cli/commands/question/QuestionCommand.java | 6 -
.../commands/question/QuestionReadByUser.java | 53 --------
.../commands/self/AbstractWorkflowCommand.java | 27 +++++
.../cli/commands/self/WorkflowCommand.java | 104 ++++++++++++++++
.../commands/self/WorkflowExportDefinition.java | 56 +++++++++
.../commands/self/WorkflowExportDiagram.java | 68 +++++++++++
.../commands/self/WorkflowResultManager.java | 38 ++++++
.../self/WorkflowSyncopeOperations.java | 41 +++++++
17 files changed, 858 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
new file mode 100644
index 0000000..acc8aa5
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
@@ -0,0 +1,27 @@
+/*
+ * 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.cli.commands.entitlement;
+
+public class AbstractEntitlementCommand {
+
+ protected final EntitlementSyncopeOperations entitlementSyncopeOperations = new EntitlementSyncopeOperations();
+
+ protected final EntitlementResultManager entitlementResultManager = new EntitlementResultManager();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
new file mode 100644
index 0000000..5ca478c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
@@ -0,0 +1,121 @@
+/*
+ * 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.cli.commands.entitlement;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "entitlement")
+public class EntitlementCommand extends AbstractCommand {
+
+ private static final String HELP_MESSAGE = "Usage: entitlement [options]\n"
+ + " Options:\n"
+ + " --help \n"
+ + " --list\n"
+ + " --list-role\n"
+ + " Syntax: --list-role {ENTITLEMENT-NAME}\n"
+ + " --read-by-username\n"
+ + " Syntax: --read-by-username {USERNAME}\n"
+ + " --read-by-userid\n"
+ + " Syntax: --read-by-userid {USERID}\n"
+ + " --search-by-role\n"
+ + " Syntax: --search-by-role {ROLE-ID}";
+
+ @Override
+ public void execute(final Input input) {
+ if (StringUtils.isBlank(input.getOption())) {
+ input.setOption(EntitlementOptions.HELP.getOptionName());
+ }
+
+ switch (EntitlementOptions.fromName(input.getOption())) {
+ case LIST:
+ new EntitlementList().list();
+ break;
+ case READ_BY_USERNAME:
+ new EntitlementReadByUsername(input).read();
+ break;
+ case READ_BY_USERID:
+ new EntitlementReadByUserId(input).read();
+ break;
+ case SEARCH_BY_ROLE:
+ new EntitlementSearchByRole(input).search();
+ break;
+ case LIST_ROLE:
+ new EntitlementListRole(input).list();
+ break;
+ case HELP:
+ System.out.println(HELP_MESSAGE);
+ break;
+ default:
+ new EntitlementResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+ }
+ }
+
+ @Override
+ public String getHelpMessage() {
+ return HELP_MESSAGE;
+ }
+
+ private enum EntitlementOptions {
+
+ HELP("--help"),
+ LIST("--list"),
+ READ_BY_USERNAME("--read-by-username"),
+ READ_BY_USERID("--read-by-userid"),
+ SEARCH_BY_ROLE("--search-by-role"),
+ LIST_ROLE("--list-role");
+
+ private final String optionName;
+
+ EntitlementOptions(final String optionName) {
+ this.optionName = optionName;
+ }
+
+ public String getOptionName() {
+ return optionName;
+ }
+
+ public boolean equalsOptionName(final String otherName) {
+ return (otherName == null) ? false : optionName.equals(otherName);
+ }
+
+ public static EntitlementOptions fromName(final String name) {
+ EntitlementOptions optionToReturn = HELP;
+ for (final EntitlementOptions option : EntitlementOptions.values()) {
+ if (option.equalsOptionName(name)) {
+ optionToReturn = option;
+ }
+ }
+ return optionToReturn;
+ }
+
+ public static List<String> toList() {
+ final List<String> options = new ArrayList<>();
+ for (final EntitlementOptions value : values()) {
+ options.add(value.getOptionName());
+ }
+ return options;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
new file mode 100644
index 0000000..d0c532c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
@@ -0,0 +1,26 @@
+/*
+ * 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.cli.commands.entitlement;
+
+public class EntitlementList extends AbstractEntitlementCommand {
+
+ public void list() {
+ entitlementResultManager.toView(entitlementSyncopeOperations.list());
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
new file mode 100644
index 0000000..f65757c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
@@ -0,0 +1,62 @@
+/*
+ * 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.cli.commands.entitlement;
+
+import java.util.Set;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.RoleTO;
+
+public class EntitlementListRole extends AbstractEntitlementCommand {
+
+ private static final String READ_HELP_MESSAGE = "entitlement --list-role {ENTITLEMENT-NAME}";
+
+ private final Input input;
+
+ public EntitlementListRole(final Input input) {
+ this.input = input;
+ }
+
+ public void list() {
+ if (input.getParameters().length == 1) {
+ try {
+ final Set<RoleTO> roleTOs = entitlementSyncopeOperations.rolePerEntitlements(input.firstParameter());
+ if (!entitlementSyncopeOperations.exists(input.firstParameter())) {
+ entitlementResultManager.notFoundError("Entitlement", input.firstParameter());
+ } else if (roleTOs != null && !roleTOs.isEmpty()) {
+ entitlementResultManager.rolesToView(roleTOs);
+ } else {
+ entitlementResultManager.generic("No roles found for entitlement " + input.firstParameter());
+ }
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ entitlementResultManager.notFoundError("User", input.firstParameter());
+ } else {
+ entitlementResultManager.generic("Error: " + ex.getMessage());
+ }
+ } catch (final NumberFormatException ex) {
+ entitlementResultManager.numberFormatException("user", input.firstParameter());
+ }
+ } else {
+ entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
new file mode 100644
index 0000000..99f6305
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
@@ -0,0 +1,53 @@
+/*
+ * 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.cli.commands.entitlement;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class EntitlementReadByUserId extends AbstractEntitlementCommand {
+
+ private static final String READ_HELP_MESSAGE = "entitlement --read-by-userid {USER-ID}";
+
+ private final Input input;
+
+ public EntitlementReadByUserId(final Input input) {
+ this.input = input;
+ }
+
+ public void read() {
+ if (input.getParameters().length == 1) {
+ try {
+ entitlementResultManager.toView(
+ entitlementSyncopeOperations.userIdEntitlements(input.firstParameter()));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ entitlementResultManager.notFoundError("User", input.firstParameter());
+ } else {
+ entitlementResultManager.generic("Error: " + ex.getMessage());
+ }
+ } catch (final NumberFormatException ex) {
+ entitlementResultManager.numberFormatException("user", input.firstParameter());
+ }
+ } else {
+ entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
new file mode 100644
index 0000000..bfcec00
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
@@ -0,0 +1,53 @@
+/*
+ * 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.cli.commands.entitlement;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class EntitlementReadByUsername extends AbstractEntitlementCommand {
+
+ private static final String READ_HELP_MESSAGE = "entitlement --read-by-username {USERNAME}";
+
+ private final Input input;
+
+ public EntitlementReadByUsername(final Input input) {
+ this.input = input;
+ }
+
+ public void read() {
+ if (input.getParameters().length == 1) {
+ try {
+ entitlementResultManager.toView(
+ entitlementSyncopeOperations.usernameEntitlements(input.firstParameter()));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ entitlementResultManager.notFoundError("User", input.firstParameter());
+ } else {
+ entitlementResultManager.generic("Error: " + ex.getMessage());
+ }
+ } catch (final NumberFormatException ex) {
+ entitlementResultManager.numberFormatException("user", input.firstParameter());
+ }
+ } else {
+ entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
new file mode 100644
index 0000000..01585d2
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.entitlement;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.RoleTO;
+
+public class EntitlementResultManager extends CommonsResultManager {
+
+ public void toView(final Set<String> entitlements) {
+ for (final String entitlement : entitlements) {
+ System.out.println("- " + entitlement);
+ }
+ }
+
+ public void rolesToView(final Set<RoleTO> roles) {
+ for (final RoleTO role : roles) {
+ printRole(role);
+ }
+ }
+
+ private void printRole(final RoleTO roleTO) {
+ System.out.println(" > ROLE ID: " + roleTO.getKey());
+ System.out.println(" name: " + roleTO.getName());
+ System.out.println(" REALMS: ");
+ printRealms(roleTO.getRealms());
+ System.out.println("");
+ }
+
+ private void printRealms(final List<String> realms) {
+ for (final String realm : realms) {
+ System.out.println(" - " + realm);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
new file mode 100644
index 0000000..6d756f0
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.entitlement;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class EntitlementSearchByRole extends AbstractEntitlementCommand {
+
+ private static final String READ_HELP_MESSAGE = "entitlement --search-by-role {ROLE-ID}";
+
+ private final Input input;
+
+ public EntitlementSearchByRole(final Input input) {
+ this.input = input;
+ }
+
+ public void search() {
+ if (input.getParameters().length == 1) {
+ try {
+ entitlementResultManager.toView(
+ entitlementSyncopeOperations.entitlementsPerRole(input.firstParameter()));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ entitlementResultManager.notFoundError("User", input.firstParameter());
+ } else {
+ entitlementResultManager.generic("Error: " + ex.getMessage());
+ }
+ } catch (final NumberFormatException ex) {
+ entitlementResultManager.numberFormatException("user", input.firstParameter());
+ }
+ } else {
+ entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java
new file mode 100644
index 0000000..17c8eee
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java
@@ -0,0 +1,74 @@
+/*
+ * 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.cli.commands.entitlement;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.TreeSet;
+import org.apache.syncope.client.cli.commands.role.RoleSyncopeOperations;
+import org.apache.syncope.client.cli.commands.user.UserSyncopeOperations;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.Entitlement;
+
+public class EntitlementSyncopeOperations {
+
+ private final UserSyncopeOperations userSyncopeOperations = new UserSyncopeOperations();
+
+ private final RoleSyncopeOperations roleSyncopeOperations = new RoleSyncopeOperations();
+
+ public Set<String> list() {
+ return Entitlement.values();
+ }
+
+ public boolean exists(final String entitlement) {
+ return list().contains(entitlement);
+ }
+
+ public Set<String> usernameEntitlements(final String username) {
+ final Set<String> entitlements = new TreeSet<>();
+ final UserTO userTO = userSyncopeOperations.read(userSyncopeOperations.getIdFromUsername(username));
+ for (final Long role : userTO.getRoles()) {
+ entitlements.addAll(roleSyncopeOperations.read(String.valueOf(role)).getEntitlements());
+ }
+ return entitlements;
+ }
+
+ public Set<String> userIdEntitlements(final String userId) {
+ final Set<String> entitlements = new TreeSet<>();
+ final UserTO userTO = userSyncopeOperations.read(userId);
+ for (final Long role : userTO.getRoles()) {
+ entitlements.addAll(roleSyncopeOperations.read(String.valueOf(role)).getEntitlements());
+ }
+ return entitlements;
+ }
+
+ public Set<String> entitlementsPerRole(final String roleId) {
+ return roleSyncopeOperations.read(roleId).getEntitlements();
+ }
+
+ public Set<RoleTO> rolePerEntitlements(final String entitlement) {
+ final Set<RoleTO> roles = new HashSet<>();
+ for (final RoleTO role : roleSyncopeOperations.list()) {
+ role.getEntitlements().contains(entitlement);
+ roles.add(role);
+ }
+ return roles;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
index 2427203..4d48b8d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
@@ -34,8 +34,6 @@ public class QuestionCommand extends AbstractCommand {
+ " --list \n"
+ " --read \n"
+ " Syntax: --read {QUESTION-ID} {QUESTION-ID} [...]\n"
- + " --read-by-user \n"
- + " Syntax: --read-by-user {USERNAME}\n"
+ " --delete \n"
+ " Syntax: --delete {QUESTION-ID} {QUESTION-ID} [...]";
@@ -52,9 +50,6 @@ public class QuestionCommand extends AbstractCommand {
case READ:
new QuestionRead(input).read();
break;
- case READ_BY_USER:
- new QuestionReadByUser(input).read();
- break;
case DELETE:
break;
case HELP:
@@ -75,7 +70,6 @@ public class QuestionCommand extends AbstractCommand {
HELP("--help"),
LIST("--list"),
READ("--read"),
- READ_BY_USER("--read-by-user"),
DELETE("--delete");
private final String optionName;
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java
deleted file mode 100644
index fa7b23d..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-
-public class QuestionReadByUser extends AbstractQuestionCommand {
-
- private static final String READ_HELP_MESSAGE = "question --read-by-user {USERNAME}";
-
- private final Input input;
-
- public QuestionReadByUser(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length == 1) {
- try {
- questionResultManager.printQuestion(questionSyncopeOperations.readByUser(input.firstParameter()));
- } catch (final SyncopeClientException | WebServiceException ex) {
- if (ex.getMessage().startsWith("NotFound")) {
- questionResultManager.notFoundError("Security question", input.firstParameter());
- } else {
- questionResultManager.generic("Error: " + ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- questionResultManager.numberFormatException("security question", input.firstParameter());
- }
- } else {
- questionResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/AbstractWorkflowCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/AbstractWorkflowCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/AbstractWorkflowCommand.java
new file mode 100644
index 0000000..c48eb8c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/AbstractWorkflowCommand.java
@@ -0,0 +1,27 @@
+/*
+ * 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.cli.commands.self;
+
+public class AbstractWorkflowCommand {
+
+ protected final WorkflowResultManager workflowResultManager = new WorkflowResultManager();
+
+ protected final WorkflowSyncopeOperations workflowSyncopeOperations = new WorkflowSyncopeOperations();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
new file mode 100644
index 0000000..c40dda9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
@@ -0,0 +1,104 @@
+/*
+ * 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.cli.commands.self;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "workflow")
+public class WorkflowCommand extends AbstractCommand {
+
+ private static final String HELP_MESSAGE = "Usage: workflow [options]\n"
+ + " Options:\n"
+ + " --help \n"
+ + " --export-diagram {ANY-TYPE-KIND}\n"
+ + " Any type kind: ANY_OBJECT / USER / GROUP\n"
+ + " --export-definition {ANY-TYPE-KIND}\n"
+ + " Any type kind: ANY_OBJECT / USER / GROUP";
+
+ @Override
+ public void execute(final Input input) {
+ if (StringUtils.isBlank(input.getOption())) {
+ input.setOption(UserWorkflowOptions.HELP.getOptionName());
+ }
+
+ switch (UserWorkflowOptions.fromName(input.getOption())) {
+ case EXPORT_DIAGRAM:
+ new WorkflowExportDiagram(input).export();
+ break;
+ case EXPORT_DEFINITION:
+ new WorkflowExportDefinition(input).export();
+ break;
+ case HELP:
+ System.out.println(HELP_MESSAGE);
+ break;
+ default:
+ new WorkflowResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+ }
+ }
+
+ @Override
+ public String getHelpMessage() {
+ return HELP_MESSAGE;
+ }
+
+ private enum UserWorkflowOptions {
+
+ HELP("--help"),
+ EXPORT_DIAGRAM("--export-diagram"),
+ EXPORT_DEFINITION("--export-definition");
+
+ private final String optionName;
+
+ UserWorkflowOptions(final String optionName) {
+ this.optionName = optionName;
+ }
+
+ public String getOptionName() {
+ return optionName;
+ }
+
+ public boolean equalsOptionName(final String otherName) {
+ return (otherName == null) ? false : optionName.equals(otherName);
+ }
+
+ public static UserWorkflowOptions fromName(final String name) {
+ UserWorkflowOptions optionToReturn = HELP;
+ for (final UserWorkflowOptions option : UserWorkflowOptions.values()) {
+ if (option.equalsOptionName(name)) {
+ optionToReturn = option;
+ }
+ }
+ return optionToReturn;
+ }
+
+ public static List<String> toList() {
+ final List<String> options = new ArrayList<>();
+ for (final UserWorkflowOptions value : values()) {
+ options.add(value.getOptionName());
+ }
+ return options;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
new file mode 100644
index 0000000..89443da
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
@@ -0,0 +1,56 @@
+/*
+ * 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.cli.commands.self;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+
+public class WorkflowExportDefinition extends AbstractWorkflowCommand {
+
+ private static final String EXPORT_HELP_MESSAGE = "workflow --export-definition {ANY-TYPE-KIND}\n";
+
+ private final Input input;
+
+ public WorkflowExportDefinition(final Input input) {
+ this.input = input;
+ }
+
+ public void export() {
+ if (input.parameterNumber() == 1) {
+ try {
+ final AnyTypeKind anyTypeKind = AnyTypeKind.valueOf(input.firstParameter());
+ System.out.println(" > > > > " + workflowSyncopeOperations.exportDefinition(anyTypeKind).getEntity());
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ workflowResultManager.notFoundError("Workflow", input.firstParameter());
+ } else {
+ workflowResultManager.generic(ex.getMessage());
+ }
+ } catch (final IllegalArgumentException ex) {
+ workflowResultManager.typeNotValidError(
+ "workflow", input.firstParameter(), CommandUtils.fromEnumToArray(AnyTypeKind.class));
+ }
+ } else {
+ workflowResultManager.commandOptionError(EXPORT_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
new file mode 100644
index 0000000..f65bf2f
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
@@ -0,0 +1,68 @@
+/*
+ * 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.cli.commands.self;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.ws.rs.core.Response;
+import javax.xml.ws.WebServiceException;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.util.CommandUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+
+public class WorkflowExportDiagram extends AbstractWorkflowCommand {
+
+ private static final String EXPORT_HELP_MESSAGE = "workflow --export-diagram {ANY-TYPE-KIND}\n";
+
+ private final Input input;
+
+ public WorkflowExportDiagram(final Input input) {
+ this.input = input;
+ }
+
+ public void export() {
+ if (input.parameterNumber() == 1) {
+ try {
+ final AnyTypeKind anyTypeKind = AnyTypeKind.valueOf(input.firstParameter());
+ final Response response = workflowSyncopeOperations.exportDiagram(anyTypeKind);
+ final byte[] diagram = IOUtils.readBytesFromStream((InputStream) response.getEntity());
+ final FileOutputStream fos = new FileOutputStream("/tmp/diagram.png");
+ fos.write(diagram);
+ fos.close();
+ workflowResultManager.generic("Diagram created: /tmp/diagram.png");
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ workflowResultManager.notFoundError("Workflow", input.firstParameter());
+ } else {
+ workflowResultManager.generic(ex.getMessage());
+ }
+ } catch (final IllegalArgumentException ex) {
+ workflowResultManager.typeNotValidError(
+ "workflow", input.firstParameter(), CommandUtils.fromEnumToArray(AnyTypeKind.class));
+ } catch (final IOException ex) {
+
+ }
+ } else {
+ workflowResultManager.commandOptionError(EXPORT_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowResultManager.java
new file mode 100644
index 0000000..2737a6a
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowResultManager.java
@@ -0,0 +1,38 @@
+/*
+ * 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.cli.commands.self;
+
+import java.util.List;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.WorkflowFormTO;
+
+public class WorkflowResultManager extends CommonsResultManager {
+
+ public void toView(final List<WorkflowFormTO> workflowFormTOs) {
+ for (final WorkflowFormTO workflowFormTO : workflowFormTOs) {
+ printQuestion(workflowFormTO);
+ }
+ }
+
+ public void printQuestion(final WorkflowFormTO workflowFormTO) {
+ System.out.println(" > WORKFLOW FORM ID: " + workflowFormTO.getKey());
+ System.out.println(" description: " + workflowFormTO.getDescription());
+ System.out.println("");
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/3c36fe10/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
new file mode 100644
index 0000000..2add12d
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cli.commands.self;
+
+import javax.ws.rs.core.Response;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.WorkflowService;
+
+public class WorkflowSyncopeOperations {
+
+ private final WorkflowService workflowService = SyncopeServices.get(WorkflowService.class);
+
+ public Response exportDiagram(final AnyTypeKind anyTypeKind) {
+ WebClient.client(workflowService).accept(RESTHeaders.MEDIATYPE_IMAGE_PNG);
+ return workflowService.exportDiagram(anyTypeKind);
+ }
+
+ public Response exportDefinition(final AnyTypeKind anyTypeKind) {
+ return workflowService.exportDefinition(anyTypeKind);
+ }
+
+}
[06/50] [abbrv] syncope git commit: [SYNCOPE-714] Consolidating old
buildSchemaNames and buildSupportedObjectClasses into new buildO
bjectClassInfo
Posted by fm...@apache.org.
[SYNCOPE-714] Consolidating old buildSchemaNames and buildSupportedObjectClasses into new buildO
bjectClassInfo
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1347c108
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1347c108
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1347c108
Branch: refs/heads/SYNCOPE-156
Commit: 1347c1081dd9eb3e32ae0b0f39e47fa5498aa3c3
Parents: 9343981
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 26 10:55:14 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 26 10:55:14 2015 +0100
----------------------------------------------------------------------
.../ConnectorListConfigurationProperties.java | 4 +-
.../connector/ConnectorResultManager.java | 7 +-
.../console/pages/ProvisioningModalPage.java | 17 +-
.../client/console/panels/ConnectorModal.java | 14 +-
.../console/panels/ResourceConnConfPanel.java | 10 +-
.../console/panels/ResourceMappingPanel.java | 20 ++-
.../console/rest/ConnectorRestClient.java | 40 ++---
.../client/console/rest/LoggerRestClient.java | 4 +-
.../client/console/rest/ResourceRestClient.java | 12 +-
.../lib/patch/ResourceDeassociationPatch.java | 80 +++++++++
.../common/lib/to/ConnIdObjectClassTO.java | 78 +++++++++
.../syncope/common/lib/to/ConnInstanceTO.java | 38 ++---
.../syncope/common/lib/to/ResourceTO.java | 31 +++-
.../common/lib/wrap/AbstractWrappable.java | 46 ------
.../apache/syncope/common/lib/wrap/AnyKey.java | 30 ----
.../common/lib/wrap/ConnIdObjectClass.java | 30 ----
.../syncope/common/lib/wrap/package-info.java | 23 ---
.../common/rest/api/CollectionWrapper.java | 80 ---------
.../syncope/common/rest/api/LoggerWrapper.java | 56 +++++++
.../rest/api/service/ConnectorService.java | 29 +---
.../rest/api/service/ResourceService.java | 14 +-
.../syncope/core/logic/ConnectorLogic.java | 76 +++------
.../syncope/core/logic/ResourceLogic.java | 21 ++-
.../apache/syncope/core/misc/MappingUtils.java | 33 +++-
.../persistence/api/entity/ConnInstance.java | 41 +++--
.../api/entity/resource/ExternalResource.java | 11 +-
.../persistence/jpa/entity/JPAConnInstance.java | 33 +---
.../entity/resource/JPAExternalResource.java | 46 +++++-
.../persistence/jpa/DummyConnectorRegistry.java | 13 +-
.../persistence/jpa/inner/ConnInstanceTest.java | 6 +-
.../persistence/jpa/outer/ConnInstanceTest.java | 2 +-
.../test/resources/domains/MasterContent.xml | 44 ++---
.../provisioning/api/ConnIdBundleManager.java | 2 +-
.../core/provisioning/api/Connector.java | 50 +-----
.../core/provisioning/api/ConnectorFactory.java | 23 ++-
.../provisioning/api/ConnectorRegistry.java | 12 --
.../api/data/ConnInstanceDataBinder.java | 16 +-
.../api/data/ResourceDataBinder.java | 7 +-
.../provisioning/java/AsyncConnectorFacade.java | 82 +---------
.../provisioning/java/ConnectorFacadeProxy.java | 164 +++++--------------
.../provisioning/java/ConnectorManager.java | 76 +++++----
.../provisioning/java/VirAttrHandlerImpl.java | 2 +-
.../java/data/ConnInstanceDataBinderImpl.java | 47 +-----
.../java/data/ResourceDataBinderImpl.java | 29 ++--
.../AbstractPropagationTaskExecutor.java | 2 +-
.../DBPasswordPropagationActions.java | 2 +-
.../LDAPPasswordPropagationActions.java | 2 +-
.../java/sync/AbstractPushResultHandler.java | 2 +-
.../java/sync/DBPasswordSyncActions.java | 4 +-
.../java/sync/LDAPMembershipSyncActions.java | 10 +-
.../provisioning/java/sync/SyncJobDelegate.java | 5 +-
.../core/provisioning/java/sync/SyncUtils.java | 2 +-
.../rest/cxf/service/ConnectorServiceImpl.java | 13 +-
.../rest/cxf/service/LoggerServiceImpl.java | 4 +-
.../rest/cxf/service/ResourceServiceImpl.java | 37 ++---
.../fit/core/reference/AbstractITCase.java | 2 +-
.../fit/core/reference/ConnectorITCase.java | 84 ++++------
.../fit/core/reference/LoggerITCase.java | 8 +-
.../fit/core/reference/ResourceITCase.java | 2 +-
.../fit/core/reference/SyncTaskITCase.java | 2 +-
.../fit/core/reference/VirAttrITCase.java | 4 +-
61 files changed, 720 insertions(+), 964 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
index 6b80e8e..3e454d7 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
@@ -37,8 +37,8 @@ public class ConnectorListConfigurationProperties extends AbstractConnectorComma
if (input.getParameters().length >= 1) {
for (final String parameter : input.getParameters()) {
try {
- connectorResultManager.fromListConfigurationProperties(
- connectorService.getConfigurationProperties(Long.valueOf(parameter)));
+ connectorResultManager.fromConfigurationProperties(
+ connectorService.read(Long.valueOf(parameter), null).getConf());
} catch (final NumberFormatException ex) {
connectorResultManager.managerNumberFormatException("connector", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
index b6edbc2..7c72349 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.client.cli.commands.connector;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
@@ -49,8 +48,8 @@ public class ConnectorResultManager extends CommonsResultManager {
}
}
- public void fromListConfigurationProperties(final List<ConnConfProperty> connConfPropertys) {
- printConfiguration(new HashSet<>(connConfPropertys));
+ public void fromConfigurationProperties(final Set<ConnConfProperty> connConfPropertys) {
+ printConfiguration(connConfPropertys);
}
@@ -65,7 +64,7 @@ public class ConnectorResultManager extends CommonsResultManager {
System.out.println(" CAPABILITIES:");
printCapabilities(connInstanceTO.getCapabilities());
System.out.println(" CONFIGURATION:");
- printConfiguration(connInstanceTO.getConfiguration());
+ printConfiguration(connInstanceTO.getConf());
System.out.println(" POOL CONFIGURATION:");
printConfPool(connInstanceTO.getPoolConf());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
index c66d650..43944bd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
@@ -37,8 +37,6 @@ import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
-import org.apache.syncope.common.lib.wrap.AbstractWrappable;
-import org.apache.syncope.common.lib.wrap.AnyKey;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
@@ -227,26 +225,25 @@ public class ProvisioningModalPage<T extends AnyTO> extends AbstractStatusModalP
private void bulkAssociationAction(
final AjaxRequestTarget target,
- final ResourceDeassociationAction type,
+ final ResourceDeassociationAction action,
final ActionDataTablePanel<StatusBean, String> table,
final List<IColumn<StatusBean, String>> columns) {
- final List<StatusBean> beans = new ArrayList<>(table.getModelObject());
- List<AnyKey> subjectKeys = new ArrayList<>();
+ List<StatusBean> beans = new ArrayList<>(table.getModelObject());
+ List<Long> anyKeys = new ArrayList<>();
for (StatusBean bean : beans) {
- LOG.debug("Selected bean {}", bean);
- subjectKeys.add(AbstractWrappable.getInstance(AnyKey.class, bean.getAnyKey()));
+ anyKeys.add(bean.getAnyKey());
}
if (beans.isEmpty()) {
window.close(target);
} else {
- final BulkActionResult res = resourceRestClient.bulkAssociationAction(
- resourceTO.getKey(), anyTypeKind.name(), type, subjectKeys);
+ BulkActionResult result =
+ resourceRestClient.bulkAssociationAction(resourceTO.getKey(), anyTypeKind.name(), action, anyKeys);
((BasePage) pageRef.getPage()).setModalResult(true);
- setResponsePage(new BulkActionResultModalPage<>(window, beans, columns, res, "anyKey"));
+ setResponsePage(new BulkActionResultModalPage<>(window, beans, columns, result, "anyKey"));
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
index 4f5e8eb..f02cbe9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorModal.java
@@ -286,7 +286,7 @@ public class ConnectorModal extends AbstractResourceModal {
// form - second tab (properties)
final ListView<ConnConfProperty> connPropView = new ConnConfPropertyListView("connectorProperties",
new PropertyModel<List<ConnConfProperty>>(this, "properties"),
- true, connInstanceTO.getConfiguration());
+ true, connInstanceTO.getConf());
connPropView.setOutputMarkupId(true);
connectorPropForm.add(connPropView);
@@ -353,8 +353,8 @@ public class ConnectorModal extends AbstractResourceModal {
conn.setConnectorName(bundleTO.getConnectorName());
conn.setBundleName(bundleTO.getBundleName());
conn.setVersion(bundleTO.getVersion());
- conn.getConfiguration().clear();
- conn.getConfiguration().addAll(connPropView.getModelObject());
+ conn.getConf().clear();
+ conn.getConf().addAll(connPropView.getModelObject());
// Set the model object's capabilities to capabilitiesPalette's converted Set
conn.getCapabilities().clear();
@@ -448,11 +448,11 @@ public class ConnectorModal extends AbstractResourceModal {
final ConnConfProperty property = new ConnConfProperty();
property.setSchema(key);
if (connInstanceTO.getKey() != 0
- && connInstanceTO.getConfigurationMap().containsKey(key.getName())
- && connInstanceTO.getConfigurationMap().get(key.getName()).getValues() != null) {
+ && connInstanceTO.getConfMap().containsKey(key.getName())
+ && connInstanceTO.getConfMap().get(key.getName()).getValues() != null) {
- property.getValues().addAll(connInstanceTO.getConfigurationMap().get(key.getName()).getValues());
- property.setOverridable(connInstanceTO.getConfigurationMap().get(key.getName()).isOverridable());
+ property.getValues().addAll(connInstanceTO.getConfMap().get(key.getName()).getValues());
+ property.setOverridable(connInstanceTO.getConfMap().get(key.getName()).isOverridable());
}
if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
index 246e0eb..fdb9f83 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
@@ -79,7 +79,7 @@ public class ResourceConnConfPanel extends Panel {
*/
final ListView<ConnConfProperty> connPropView = new ConnConfPropertyListView("connectorProperties",
new PropertyModel<List<ConnConfProperty>>(this, "connConfProperties"),
- false, resourceTO.getConnConfProperties());
+ false, resourceTO.getConfOverride());
connPropView.setOutputMarkupId(true);
connConfPropContainer.add(connPropView);
@@ -116,17 +116,17 @@ public class ResourceConnConfPanel extends Panel {
List<ConnConfProperty> props = new ArrayList<>();
Long connectorKey = resourceTO.getConnector();
if (connectorKey != null && connectorKey > 0) {
- for (ConnConfProperty property : restClient.read(connectorKey).getConfiguration()) {
+ for (ConnConfProperty property : restClient.read(connectorKey).getConf()) {
if (property.isOverridable()) {
props.add(property);
}
}
}
- if (createFlag || resourceTO.getConnConfProperties().isEmpty()) {
- resourceTO.getConnConfProperties().clear();
+ if (createFlag || resourceTO.getConfOverride().isEmpty()) {
+ resourceTO.getConfOverride().clear();
} else {
Map<String, ConnConfProperty> valuedProps = new HashMap<>();
- for (ConnConfProperty prop : resourceTO.getConnConfProperties()) {
+ for (ConnConfProperty prop : resourceTO.getConfOverride()) {
valuedProps.put(prop.getSchema().getName(), prop);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
index 40cc013..ceabd57 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
@@ -25,6 +25,8 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.JexlHelpUtils;
import org.apache.syncope.client.console.panels.ResourceConnConfPanel.ConnConfModEvent;
@@ -36,6 +38,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownCho
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.MappingPurposePanel;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
@@ -156,7 +159,7 @@ public class ResourceMappingPanel extends Panel {
add(this.mappingContainer);
if (resourceTO.getConnector() != null && resourceTO.getConnector() > 0) {
- schemaNames = getSchemaNames(resourceTO.getConnector(), resourceTO.getConnConfProperties());
+ schemaNames = getSchemaNames(resourceTO.getConnector(), resourceTO.getConfOverride());
setEnabled();
} else {
schemaNames = Collections.<String>emptyList();
@@ -441,15 +444,24 @@ public class ResourceMappingPanel extends Panel {
private List<String> getSchemaNames(final Long connectorId, final Set<ConnConfProperty> conf) {
final ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setKey(connectorId);
- connInstanceTO.getConfiguration().addAll(conf);
+ connInstanceTO.getConf().addAll(conf);
- return connRestClient.getSchemaNames(connInstanceTO);
+ // SYNCOPE-156: use provided info to give schema names (and type!) by ObjectClass
+ return CollectionUtils.collect(connRestClient.buildObjectClassInfo(connInstanceTO, true),
+ new Transformer<ConnIdObjectClassTO, String>() {
+
+ @Override
+ public String transform(final ConnIdObjectClassTO input) {
+ return input.getType();
+ }
+ },
+ new ArrayList<String>());
}
private void setEnabled() {
ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setKey(resourceTO.getConnector());
- connInstanceTO.getConfiguration().addAll(resourceTO.getConnConfProperties());
+ connInstanceTO.getConf().addAll(resourceTO.getConfOverride());
boolean enabled = provisionTO != null;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
index 8c84993..d483411 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
@@ -28,11 +28,10 @@ import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.wrap.ConnIdObjectClass;
import org.apache.syncope.common.rest.api.service.ConnectorService;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.springframework.beans.BeanUtils;
@@ -57,9 +56,9 @@ public class ConnectorRestClient extends BaseRestClient {
}
public void create(final ConnInstanceTO connectorTO) {
- Set<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConfiguration());
- connectorTO.getConfiguration().clear();
- connectorTO.getConfiguration().addAll(filteredConf);
+ Set<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConf());
+ connectorTO.getConf().clear();
+ connectorTO.getConf().addAll(filteredConf);
getService(ConnectorService.class).create(connectorTO);
}
@@ -83,9 +82,9 @@ public class ConnectorRestClient extends BaseRestClient {
}
public void update(final ConnInstanceTO connectorTO) {
- Set<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConfiguration());
- connectorTO.getConfiguration().clear();
- connectorTO.getConfiguration().addAll(filteredConf);
+ Set<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConf());
+ connectorTO.getConf().clear();
+ connectorTO.getConf().addAll(filteredConf);
getService(ConnectorService.class).update(connectorTO);
}
@@ -139,7 +138,7 @@ public class ConnectorRestClient extends BaseRestClient {
public boolean check(final ConnInstanceTO connectorTO) {
ConnInstanceTO toBeChecked = new ConnInstanceTO();
BeanUtils.copyProperties(connectorTO, toBeChecked, new String[] { "configuration", "configurationMap" });
- toBeChecked.getConfiguration().addAll(filterProperties(connectorTO.getConfiguration()));
+ toBeChecked.getConf().addAll(filterProperties(connectorTO.getConf()));
boolean check = false;
try {
@@ -164,27 +163,12 @@ public class ConnectorRestClient extends BaseRestClient {
return check;
}
- public List<String> getSchemaNames(final ConnInstanceTO connectorTO) {
- List<String> schemaNames = new ArrayList<>();
- try {
- List<PlainSchemaTO> response = getService(ConnectorService.class).buildSchemaNames(connectorTO, false);
- for (PlainSchemaTO schema : response) {
- schemaNames.add(schema.getKey());
- }
- } catch (Exception e) {
- LOG.error("While getting schema names", e);
- } finally {
- // re-order schema names list
- Collections.sort(schemaNames);
- }
-
- return schemaNames;
- }
+ public List<ConnIdObjectClassTO> buildObjectClassInfo(
+ final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
- public List<ConnIdObjectClass> getSupportedObjectClasses(final ConnInstanceTO connectorTO) {
- List<ConnIdObjectClass> result = Collections.emptyList();
+ List<ConnIdObjectClassTO> result = Collections.emptyList();
try {
- result = getService(ConnectorService.class).buildSupportedObjectClasses(connectorTO);
+ result = getService(ConnectorService.class).buildObjectClassInfo(connInstanceTO, includeSpecial);
} catch (Exception e) {
LOG.error("While getting supported object classes", e);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
index 627e828..56283ab 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
@@ -29,7 +29,7 @@ import org.apache.syncope.common.lib.to.LoggerTO;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.LoggerLevel;
import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.common.rest.api.CollectionWrapper;
+import org.apache.syncope.common.rest.api.LoggerWrapper;
import org.apache.syncope.common.rest.api.service.LoggerService;
import org.springframework.stereotype.Component;
@@ -43,7 +43,7 @@ public class LoggerRestClient extends BaseRestClient {
}
public List<AuditLoggerName> listAudits() {
- return CollectionWrapper.wrapLogger(getService(LoggerService.class).list(LoggerType.AUDIT));
+ return LoggerWrapper.wrap(getService(LoggerService.class).list(LoggerType.AUDIT));
}
public Map<String, Set<AuditLoggerName>> listAuditsByCategory() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
index 5efa119..f5579cf 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
@@ -21,11 +21,11 @@ package org.apache.syncope.client.console.rest;
import java.util.List;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
-import org.apache.syncope.common.lib.wrap.AnyKey;
import org.apache.syncope.common.rest.api.service.ResourceService;
import org.springframework.stereotype.Component;
@@ -82,8 +82,14 @@ public class ResourceRestClient extends BaseRestClient {
public BulkActionResult bulkAssociationAction(
final String resourceName, final String anyTypeName,
- final ResourceDeassociationAction type, final List<AnyKey> anyKeys) {
+ final ResourceDeassociationAction action, final List<Long> anyKeys) {
- return getService(ResourceService.class).bulkDeassociation(resourceName, anyTypeName, type, anyKeys);
+ ResourceDeassociationPatch patch = new ResourceDeassociationPatch();
+ patch.setKey(resourceName);
+ patch.setAnyTypeKey(anyTypeName);
+ patch.setAction(action);
+ patch.getAnyKyes().addAll(anyKeys);
+
+ return getService(ResourceService.class).bulkDeassociation(patch);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/patch/ResourceDeassociationPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/ResourceDeassociationPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/ResourceDeassociationPatch.java
new file mode 100644
index 0000000..9738498
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/ResourceDeassociationPatch.java
@@ -0,0 +1,80 @@
+/*
+ * 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.patch;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.PathParam;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
+
+@XmlRootElement(name = "resourceDeassociationPatch")
+@XmlType
+public class ResourceDeassociationPatch extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -9116268525079837276L;
+
+ private String key;
+
+ private String anyTypeKey;
+
+ private ResourceDeassociationAction action;
+
+ private final List<Long> anyKyes = new ArrayList<>();
+
+ public String getKey() {
+ return key;
+ }
+
+ @PathParam("key")
+ public void setKey(final String key) {
+ this.key = key;
+ }
+
+ public String getAnyTypeKey() {
+ return anyTypeKey;
+ }
+
+ @PathParam("anyTypeKey")
+ public void setAnyTypeKey(final String anyTypeKey) {
+ this.anyTypeKey = anyTypeKey;
+ }
+
+ public ResourceDeassociationAction getAction() {
+ return action;
+ }
+
+ @PathParam("action")
+ public void setAction(final ResourceDeassociationAction action) {
+ this.action = action;
+ }
+
+ @XmlElementWrapper(name = "anyKyes")
+ @XmlElement(name = "key")
+ @JsonProperty("anyKyes")
+ public List<Long> getAnyKyes() {
+ return anyKyes;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
new file mode 100644
index 0000000..be1b6d6
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnIdObjectClassTO.java
@@ -0,0 +1,78 @@
+/*
+ * 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.to;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+/**
+ * Metadata description of ConnId ObjectClass.
+ */
+@XmlRootElement(name = "connIdObjectClass")
+@XmlType
+public class ConnIdObjectClassTO extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -3719658595689434648L;
+
+ private String type;
+
+ private boolean container;
+
+ private boolean auxiliary;
+
+ private final List<String> attributes = new ArrayList<>();
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isContainer() {
+ return container;
+ }
+
+ public void setContainer(final boolean container) {
+ this.container = container;
+ }
+
+ public boolean isAuxiliary() {
+ return auxiliary;
+ }
+
+ public void setAuxiliary(final boolean auxiliary) {
+ this.auxiliary = auxiliary;
+ }
+
+ @XmlElementWrapper(name = "attributes")
+ @XmlElement(name = "attribute")
+ @JsonProperty("attributes")
+ public List<String> getAttributes() {
+ return attributes;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnInstanceTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnInstanceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnInstanceTO.java
index 2111570..257f2ed 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnInstanceTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConnInstanceTO.java
@@ -51,9 +51,9 @@ public class ConnInstanceTO extends AbstractBaseBean {
private String version;
- private final Set<ConnConfProperty> configuration;
+ private final Set<ConnConfProperty> conf = new HashSet<>();
- private final Set<ConnectorCapability> capabilities;
+ private final Set<ConnectorCapability> capabilities = EnumSet.noneOf(ConnectorCapability.class);
private String displayName;
@@ -61,13 +61,6 @@ public class ConnInstanceTO extends AbstractBaseBean {
private ConnPoolConfTO poolConf;
- public ConnInstanceTO() {
- super();
-
- configuration = new HashSet<>();
- capabilities = EnumSet.noneOf(ConnectorCapability.class);
- }
-
public long getKey() {
return key;
}
@@ -109,28 +102,23 @@ public class ConnInstanceTO extends AbstractBaseBean {
this.version = version;
}
- @XmlElementWrapper(name = "configuration")
+ @XmlElementWrapper(name = "conf")
@XmlElement(name = "property")
- @JsonProperty("configuration")
- public Set<ConnConfProperty> getConfiguration() {
- return this.configuration;
+ @JsonProperty("conf")
+ public Set<ConnConfProperty> getConf() {
+ return this.conf;
}
@JsonIgnore
- public Map<String, ConnConfProperty> getConfigurationMap() {
- Map<String, ConnConfProperty> result;
-
- if (getConfiguration() == null) {
- result = Collections.<String, ConnConfProperty>emptyMap();
- } else {
- result = new HashMap<>();
- for (ConnConfProperty prop : getConfiguration()) {
- result.put(prop.getSchema().getName(), prop);
- }
- result = Collections.unmodifiableMap(result);
+ public Map<String, ConnConfProperty> getConfMap() {
+ Map<String, ConnConfProperty> result = new HashMap<>();
+
+ for (ConnConfProperty prop : getConf()) {
+ result.put(prop.getSchema().getName(), prop);
}
+ result = Collections.unmodifiableMap(result);
- return result;
+ return Collections.unmodifiableMap(result);
}
@XmlElementWrapper(name = "capabilities")
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
index 419b852..fc540a9 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
@@ -21,6 +21,7 @@ package org.apache.syncope.common.lib.to;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -32,6 +33,7 @@ import javax.xml.bind.annotation.XmlType;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.common.lib.types.TraceLevel;
@XmlRootElement(name = "resource")
@@ -76,7 +78,11 @@ public class ResourceTO extends AbstractAnnotatedBean {
private Long syncPolicy;
- private final Set<ConnConfProperty> connConfProperties = new HashSet<>();
+ private final Set<ConnConfProperty> confOverride = new HashSet<>();
+
+ private boolean overrideCapabilities = false;
+
+ private final Set<ConnectorCapability> capabilitiesOverride = EnumSet.noneOf(ConnectorCapability.class);
private final List<String> propagationActionsClassNames = new ArrayList<>();
@@ -203,11 +209,26 @@ public class ResourceTO extends AbstractAnnotatedBean {
return provisions;
}
- @XmlElementWrapper(name = "connConfProperties")
+ @XmlElementWrapper(name = "confOverride")
@XmlElement(name = "property")
- @JsonProperty("connConfProperties")
- public Set<ConnConfProperty> getConnConfProperties() {
- return connConfProperties;
+ @JsonProperty("confOverride")
+ public Set<ConnConfProperty> getConfOverride() {
+ return confOverride;
+ }
+
+ public boolean isOverrideCapabilities() {
+ return overrideCapabilities;
+ }
+
+ public void setOverrideCapabilities(final boolean overrideCapabilities) {
+ this.overrideCapabilities = overrideCapabilities;
+ }
+
+ @XmlElementWrapper(name = "capabilitiesOverride")
+ @XmlElement(name = "capability")
+ @JsonProperty("capabilitiesOverride")
+ public Set<ConnectorCapability> getCapabilitiesOverride() {
+ return capabilitiesOverride;
}
public TraceLevel getSyncTraceLevel() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java
deleted file mode 100644
index 7ba0afa..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.lib.wrap;
-
-import org.apache.syncope.common.lib.AbstractBaseBean;
-
-public abstract class AbstractWrappable<E> extends AbstractBaseBean {
-
- private static final long serialVersionUID = 1712808704911635170L;
-
- private E element;
-
- public static <E, T extends AbstractWrappable<E>> T getInstance(final Class<T> reference, final E element) {
- try {
- T instance = reference.newInstance();
- instance.setElement(element);
- return instance;
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not instantiate " + reference.getName(), e);
- }
- }
-
- public E getElement() {
- return element;
- }
-
- public void setElement(final E element) {
- this.element = element;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java
deleted file mode 100644
index 0eb6eef..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.lib.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "anyKey")
-@XmlType
-public class AnyKey extends AbstractWrappable<Long> {
-
- private static final long serialVersionUID = -8664228651057889297L;
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ConnIdObjectClass.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ConnIdObjectClass.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ConnIdObjectClass.java
deleted file mode 100644
index 868b3f1..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ConnIdObjectClass.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.lib.wrap;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "connIdObjectClass")
-@XmlType
-public class ConnIdObjectClass extends AbstractWrappable<String> {
-
- private static final long serialVersionUID = 613925852330408531L;
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java
deleted file mode 100644
index 397cb66..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-@XmlSchema(namespace = SyncopeConstants.NAMESPACE)
-package org.apache.syncope.common.lib.wrap;
-
-import javax.xml.bind.annotation.XmlSchema;
-import org.apache.syncope.common.lib.SyncopeConstants;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
deleted file mode 100644
index 3cdf1fa..0000000
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.rest.api;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.common.lib.to.LoggerTO;
-import org.apache.syncope.common.lib.types.AuditLoggerName;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.wrap.AbstractWrappable;
-
-public final class CollectionWrapper {
-
- private CollectionWrapper() {
- // empty constructor for static utility class
- }
-
- public static <E, T extends AbstractWrappable<E>> List<T> wrap(final E element, final Class<T> reference) {
- return Collections.singletonList(AbstractWrappable.getInstance(reference, element));
- }
-
- public static <E, T extends AbstractWrappable<E>> List<T> wrap(
- final Collection<E> collection, final Class<T> reference) {
-
- List<T> response = new ArrayList<>();
- for (E element : collection) {
- response.add(AbstractWrappable.getInstance(reference, element));
- }
- return response;
- }
-
- public static <T extends AbstractWrappable<String>> List<String> unwrap(final Collection<T> collection) {
- List<String> response = new ArrayList<>();
- for (T item : collection) {
- response.add(item.getElement());
- }
- return response;
- }
-
- public static List<AuditLoggerName> wrapLogger(final Collection<LoggerTO> logger) {
- List<AuditLoggerName> respons = new ArrayList<>();
- for (LoggerTO loggerTO : logger) {
- try {
- respons.add(AuditLoggerName.fromLoggerName(loggerTO.getKey()));
- } catch (Exception ignore) {
- // ignore
- }
- }
- return respons;
- }
-
- public static List<LoggerTO> unwrapLogger(final Collection<AuditLoggerName> auditNames) {
- List<LoggerTO> respons = new ArrayList<>();
- for (AuditLoggerName name : auditNames) {
- LoggerTO loggerTO = new LoggerTO();
- loggerTO.setKey(name.toLoggerName());
- loggerTO.setLevel(LoggerLevel.DEBUG);
- respons.add(loggerTO);
- }
- return respons;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/LoggerWrapper.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/LoggerWrapper.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/LoggerWrapper.java
new file mode 100644
index 0000000..9f9dfde
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/LoggerWrapper.java
@@ -0,0 +1,56 @@
+/*
+ * 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.rest.api;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.syncope.common.lib.to.LoggerTO;
+import org.apache.syncope.common.lib.types.AuditLoggerName;
+import org.apache.syncope.common.lib.types.LoggerLevel;
+
+public final class LoggerWrapper {
+
+ private LoggerWrapper() {
+ // empty constructor for static utility class
+ }
+
+ public static List<AuditLoggerName> wrap(final Collection<LoggerTO> logger) {
+ List<AuditLoggerName> respons = new ArrayList<>();
+ for (LoggerTO loggerTO : logger) {
+ try {
+ respons.add(AuditLoggerName.fromLoggerName(loggerTO.getKey()));
+ } catch (Exception ignore) {
+ // ignore
+ }
+ }
+ return respons;
+ }
+
+ public static List<LoggerTO> unwrap(final Collection<AuditLoggerName> auditNames) {
+ List<LoggerTO> respons = new ArrayList<>();
+ for (AuditLoggerName name : auditNames) {
+ LoggerTO loggerTO = new LoggerTO();
+ loggerTO.setKey(name.toLoggerName());
+ loggerTO.setLevel(LoggerLevel.DEBUG);
+ respons.add(loggerTO);
+ }
+ return respons;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
index ea63718..bc111ed 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
@@ -35,9 +35,8 @@ import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.wrap.ConnIdObjectClass;
/**
* REST operations for connector bundles and instances.
@@ -57,38 +56,24 @@ public interface ConnectorService extends JAXRSService {
List<ConnBundleTO> getBundles(@QueryParam("lang") String lang);
/**
- * Builds the list of schema names managed by the connector bundle matching the given connector instance key, with
- * the provided configuration.
+ * Builds the list of ConnId object classes information for the connector bundle matching the given connector
+ * instance key, with the provided configuration.
*
* @param connInstanceTO connector instance object providing configuration properties
* @param includeSpecial if set to true, special schema names (like '__PASSWORD__') will be included;
* default is false
- * @return schema names for the connector bundle matching the given connector instance key, with the provided
- * configuration
+ * @return supported object classes info for the connector bundle matching the given connector instance key, with
+ * the provided configuration
*/
@POST
- @Path("{key}/schemaNames")
+ @Path("{key}/supportedObjectClasses")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<PlainSchemaTO> buildSchemaNames(
+ List<ConnIdObjectClassTO> buildObjectClassInfo(
@NotNull ConnInstanceTO connInstanceTO,
@QueryParam("includeSpecial") @DefaultValue("false") boolean includeSpecial);
/**
- * Builds the list of supported ConnId object classes for the connector bundle matching the given connector instance
- * key, with the provided configuration.
- *
- * @param connInstanceTO connector instance object providing configuration properties
- * @return supported object classes for the connector bundle matching the given connector instance key, with the
- * provided configuration
- */
- @POST
- @Path("{key}/supportedObjectClasses")
- @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- List<ConnIdObjectClass> buildSupportedObjectClasses(@NotNull ConnInstanceTO connInstanceTO);
-
- /**
* Returns connector instance with matching key.
*
* @param key connector instance key to be read
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
index 7a3550b..d515268 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
@@ -31,13 +31,12 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PagedConnObjectTOResult;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
-import org.apache.syncope.common.lib.wrap.AnyKey;
import org.apache.syncope.common.rest.api.beans.ConnObjectTOListQuery;
/**
@@ -143,19 +142,14 @@ public interface ResourceService extends JAXRSService {
/**
* De-associate any objects from the given resource.
*
- * @param key name of resource
- * @param anyTypeKey any object kind
- * @param type resource de-association action type
- * @param keys any object keys against which the bulk action will be performed
- * @return Response object featuring BulkActionResult as Entity
+ * @param patch any objects to be used for propagation-related operations
+ * @return Bulk action result
*/
@POST
@Path("{key}/bulkDeassociation/{anyTypeKey}/{action}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
- BulkActionResult bulkDeassociation(@NotNull @PathParam("key") String key,
- @NotNull @PathParam("anyTypeKey") String anyTypeKey,
- @NotNull @PathParam("action") ResourceDeassociationAction type, @NotNull List<AnyKey> keys);
+ BulkActionResult bulkDeassociation(@NotNull ResourceDeassociationPatch patch);
/**
* Executes the provided bulk action.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
index cc6aaed..77ef94c 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
@@ -32,10 +32,9 @@ import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.common.lib.types.Entitlement;
import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
@@ -43,7 +42,6 @@ import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
-import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.ConnectorFactory;
import org.apache.syncope.core.provisioning.api.data.ConnInstanceDataBinder;
import org.identityconnectors.common.l10n.CurrentLocale;
@@ -51,7 +49,9 @@ import org.identityconnectors.framework.api.ConfigurationProperties;
import org.identityconnectors.framework.api.ConnectorInfo;
import org.identityconnectors.framework.api.ConnectorInfoManager;
import org.identityconnectors.framework.api.ConnectorKey;
-import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.identityconnectors.framework.common.objects.AttributeInfo;
+import org.identityconnectors.framework.common.objects.AttributeUtil;
+import org.identityconnectors.framework.common.objects.ObjectClassInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@@ -93,7 +93,7 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_UPDATE + "')")
public ConnInstanceTO update(final ConnInstanceTO connInstanceTO) {
- ConnInstance connInstance = binder.updateConnInstance(connInstanceTO.getKey(), connInstanceTO);
+ ConnInstance connInstance = binder.update(connInstanceTO.getKey(), connInstanceTO);
try {
connInstance = connInstanceDAO.save(connInstance);
} catch (SyncopeClientException e) {
@@ -193,7 +193,7 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(bundle);
for (String propName : properties.getPropertyNames()) {
- connBundleTO.getProperties().add(binder.buildConnConfPropSchema(properties.getProperty(propName)));
+ connBundleTO.getProperties().add(binder.build(properties.getProperty(propName)));
}
connectorBundleTOs.add(connBundleTO);
@@ -204,65 +204,41 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
}
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
- @Transactional(readOnly = true)
- public List<PlainSchemaTO> buildSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
+ public List<ConnIdObjectClassTO> buildObjectClassInfo(
+ final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
+
ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
if (connInstance == null) {
throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
}
- // consider the possibility to receive overridden properties only
- Set<ConnConfProperty> conf =
- binder.mergeConnConfProperties(connInstanceTO.getConfiguration(), connInstance.getConfiguration());
+ Set<ObjectClassInfo> objectClassInfo = connFactory.createConnector(
+ connFactory.buildConnInstanceOverride(connInstance, connInstanceTO.getConf(), null)).
+ getObjectClassInfo();
- // We cannot use Spring bean because this method could be used during resource definition or modification:
- // bean couldn't exist or couldn't be updated.
- // This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
- Set<String> schemaNames = connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial);
+ List<ConnIdObjectClassTO> result = new ArrayList<>(objectClassInfo.size());
+ for (ObjectClassInfo info : objectClassInfo) {
+ ConnIdObjectClassTO connIdObjectClassTO = new ConnIdObjectClassTO();
+ connIdObjectClassTO.setType(info.getType());
+ connIdObjectClassTO.setAuxiliary(info.isAuxiliary());
+ connIdObjectClassTO.setContainer(info.isContainer());
- return CollectionUtils.collect(schemaNames, new Transformer<String, PlainSchemaTO>() {
-
- @Override
- public PlainSchemaTO transform(final String name) {
- PlainSchemaTO schemaTO = new PlainSchemaTO();
- schemaTO.setKey(name);
- return schemaTO;
+ for (AttributeInfo attrInfo : info.getAttributeInfo()) {
+ if (includeSpecial || !AttributeUtil.isSpecialName(attrInfo.getName())) {
+ connIdObjectClassTO.getAttributes().add(attrInfo.getName());
+ }
}
- }, new ArrayList<PlainSchemaTO>());
- }
- @PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
- @Transactional(readOnly = true)
- public List<String> buildSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
- ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
- if (connInstance == null) {
- throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
+ result.add(connIdObjectClassTO);
}
- // consider the possibility to receive overridden properties only
- Set<ConnConfProperty> conf =
- binder.mergeConnConfProperties(connInstanceTO.getConfiguration(), connInstance.getConfiguration());
-
- // We cannot use Spring bean because this method could be used during resource definition or modification:
- // bean couldn't exist or couldn't be updated.
- // This is the reason why we should take a "not mature" connector facade proxy to ask for object classes.
- Set<ObjectClass> objectClasses = connFactory.createConnector(connInstance, conf).getSupportedObjectClasses();
-
- return CollectionUtils.collect(objectClasses, new Transformer<ObjectClass, String>() {
-
- @Override
- public String transform(final ObjectClass objectClass) {
- return objectClass.getObjectClassValue();
- }
- }, new ArrayList<String>());
+ return result;
}
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public void check(final ConnInstanceTO connInstanceTO) {
- Connector connector = connFactory.createConnector(
- binder.getConnInstance(connInstanceTO), connInstanceTO.getConfiguration());
- connector.test();
+ connFactory.createConnector(binder.getConnInstance(connInstanceTO)).test();
}
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
@@ -274,7 +250,7 @@ public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
if (resource == null) {
throw new NotFoundException("Resource '" + resourceName + "'");
}
- return binder.getConnInstanceTO(connFactory.getConnector(resource).getActiveConnInstance());
+ return binder.getConnInstanceTO(connFactory.getConnector(resource).getConnInstance());
}
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_RELOAD + "')")
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/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 44a5aa8..a6a2610 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
@@ -44,7 +44,6 @@ import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
import org.apache.syncope.core.provisioning.api.Connector;
@@ -54,10 +53,12 @@ import org.apache.syncope.core.misc.ConnObjectUtils;
import org.apache.syncope.core.misc.MappingUtils;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
+import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyType;
+import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.VirSchema;
import org.apache.syncope.core.persistence.api.entity.resource.Provision;
import org.identityconnectors.framework.common.objects.Attribute;
@@ -85,6 +86,9 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
private AnyObjectDAO anyObjectDAO;
@Autowired
+ private ConnInstanceDAO connInstanceDAO;
+
+ @Autowired
private UserDAO userDAO;
@Autowired
@@ -245,7 +249,7 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
ConnectorObject connectorObject = connector.getObject(
init.getRight().getObjectClass(),
new Uid(connObjectKeyValue),
- connector.getOperationOptions(mapItems));
+ MappingUtils.buildOperationOptions(mapItems));
if (connectorObject == null) {
throw new NotFoundException(
"Object " + connObjectKeyValue + " with class " + init.getRight().getObjectClass()
@@ -303,10 +307,17 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> {
@PreAuthorize("hasRole('" + Entitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public void check(final ResourceTO resourceTO) {
- ConnInstance connInstance = binder.getConnInstance(resourceTO);
- Connector connector = connFactory.createConnector(connInstance, connInstance.getConfiguration());
+ ConnInstance connInstance = connInstanceDAO.find(resourceTO.getConnector());
+ if (connInstance == null) {
+ throw new NotFoundException("Connector '" + resourceTO.getConnector() + "'");
+ }
- connector.test();
+ connFactory.createConnector(
+ connFactory.buildConnInstanceOverride(
+ connInstance,
+ resourceTO.getConfOverride(),
+ resourceTO.isOverrideCapabilities() ? resourceTO.getCapabilitiesOverride() : null)).
+ test();
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
index 54a4428..aed2ee6 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtils.java
@@ -21,6 +21,7 @@ package org.apache.syncope.core.misc;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections4.ListUtils;
@@ -75,7 +76,10 @@ import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeBuilder;
import org.identityconnectors.framework.common.objects.AttributeUtil;
import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.OperationOptions;
+import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
import org.identityconnectors.framework.common.objects.OperationalAttributes;
+import org.identityconnectors.framework.common.objects.Uid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -256,6 +260,34 @@ public class MappingUtils {
}
/**
+ * Build options for requesting all mapped connector attributes.
+ *
+ * @param mapItems mapping items
+ * @return options for requesting all mapped connector attributes
+ * @see OperationOptions
+ */
+ public static OperationOptions buildOperationOptions(final Iterator<? extends MappingItem> mapItems) {
+ OperationOptionsBuilder builder = new OperationOptionsBuilder();
+
+ Set<String> attrsToGet = new HashSet<>();
+ attrsToGet.add(Name.NAME);
+ attrsToGet.add(Uid.NAME);
+ attrsToGet.add(OperationalAttributes.ENABLE_NAME);
+
+ while (mapItems.hasNext()) {
+ MappingItem mapItem = mapItems.next();
+ if (mapItem.getPurpose() != MappingPurpose.NONE) {
+ attrsToGet.add(mapItem.getExtAttrName());
+ }
+ }
+
+ builder.setAttributesToGet(attrsToGet);
+ // -------------------------------------
+
+ return builder.build();
+ }
+
+ /**
* Prepare attributes for sending to a connector instance.
*
* @param any given any object
@@ -796,5 +828,4 @@ public class MappingUtils {
default:
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ConnInstance.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ConnInstance.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ConnInstance.java
index eb665ea..2019e8e 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ConnInstance.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/ConnInstance.java
@@ -26,47 +26,44 @@ import org.apache.syncope.common.lib.types.ConnectorCapability;
public interface ConnInstance extends Entity<Long> {
- boolean addCapability(ConnectorCapability capabitily);
-
- boolean addResource(ExternalResource resource);
-
- String getBundleName();
-
- Set<ConnectorCapability> getCapabilities();
-
- Set<ConnConfProperty> getConfiguration();
-
- Integer getConnRequestTimeout();
+ void setConnectorName(String connectorName);
String getConnectorName();
+ void setDisplayName(String displayName);
+
String getDisplayName();
+ void setLocation(String location);
+
String getLocation();
+ void setPoolConf(ConnPoolConf poolConf);
+
ConnPoolConf getPoolConf();
- List<? extends ExternalResource> getResources();
+ void setVersion(String version);
String getVersion();
- boolean removeCapability(ConnectorCapability capabitily);
+ void setBundleName(String bundleName);
- boolean removeResource(ExternalResource resource);
+ String getBundleName();
- void setBundleName(String bundleName);
+ Set<ConnectorCapability> getCapabilities();
- void setConfiguration(Set<ConnConfProperty> configuration);
+ boolean add(ExternalResource resource);
- void setConnRequestTimeout(Integer timeout);
+ boolean remove(ExternalResource resource);
- void setConnectorName(String connectorName);
+ List<? extends ExternalResource> getResources();
- void setDisplayName(String displayName);
+ void setConf(Set<ConnConfProperty> conf);
- void setLocation(String location);
+ Set<ConnConfProperty> getConf();
- void setPoolConf(ConnPoolConf poolConf);
+ void setConnRequestTimeout(Integer timeout);
+
+ Integer getConnRequestTimeout();
- void setVersion(String version);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
index 26aa9a1..0cc3c04 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
@@ -21,6 +21,7 @@ package org.apache.syncope.core.persistence.api.entity.resource;
import java.util.List;
import java.util.Set;
import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
@@ -38,9 +39,15 @@ public interface ExternalResource extends AnnotatedEntity<String> {
void setConnector(ConnInstance connector);
- Set<ConnConfProperty> getConnInstanceConfiguration();
+ Set<ConnConfProperty> getConfOverride();
- void setConnInstanceConfiguration(Set<ConnConfProperty> properties);
+ void setConfOverride(Set<ConnConfProperty> confOverride);
+
+ boolean isOverrideCapabilities();
+
+ void setOverrideCapabilities(boolean overrideCapabilities);
+
+ Set<ConnectorCapability> getCapabilitiesOverride();
AccountPolicy getAccountPolicy();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
index 054dd69..e31aaaa 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
@@ -99,8 +99,8 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
@Column(name = "capability")
@CollectionTable(name = "ConnInstance_capabilities",
joinColumns =
- @JoinColumn(name = "ConnInstance_id", referencedColumnName = "id"))
- private Set<ConnectorCapability> capabilities;
+ @JoinColumn(name = "connInstance_id", referencedColumnName = "id"))
+ private Set<ConnectorCapability> capabilities = new HashSet<>();
/**
* The main configuration for the connector instance. This is directly implemented by the Configuration bean class
@@ -118,7 +118,7 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
* External resources associated to the connector.
*/
@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "connector")
- private List<JPAExternalResource> resources;
+ private List<JPAExternalResource> resources = new ArrayList<>();
/**
* Connector request timeout. It is not applied in case of sync, full reconciliation and search.
@@ -128,13 +128,6 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
private JPAConnPoolConf poolConf;
- public JPAConnInstance() {
- super();
-
- capabilities = new HashSet<>();
- resources = new ArrayList<>();
- }
-
@Override
public Long getKey() {
return id;
@@ -181,7 +174,7 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
}
@Override
- public Set<ConnConfProperty> getConfiguration() {
+ public Set<ConnConfProperty> getConf() {
Set<ConnConfProperty> configuration = new HashSet<>();
if (!StringUtils.isBlank(jsonConf)) {
CollectionUtils.addAll(configuration, POJOHelper.deserialize(jsonConf, ConnConfProperty[].class));
@@ -191,8 +184,8 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
}
@Override
- public void setConfiguration(final Set<ConnConfProperty> configuration) {
- jsonConf = POJOHelper.serialize(new HashSet<>(configuration));
+ public void setConf(final Set<ConnConfProperty> conf) {
+ jsonConf = POJOHelper.serialize(new HashSet<>(conf));
}
@Override
@@ -211,29 +204,19 @@ public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstanc
}
@Override
- public boolean addResource(final ExternalResource resource) {
+ public boolean add(final ExternalResource resource) {
checkType(resource, JPAExternalResource.class);
return this.resources.contains((JPAExternalResource) resource)
|| this.resources.add((JPAExternalResource) resource);
}
@Override
- public boolean removeResource(final ExternalResource resource) {
+ public boolean remove(final ExternalResource resource) {
checkType(resource, JPAExternalResource.class);
return this.resources.remove((JPAExternalResource) resource);
}
@Override
- public boolean addCapability(final ConnectorCapability capabitily) {
- return capabilities.add(capabitily);
- }
-
- @Override
- public boolean removeCapability(final ConnectorCapability capabitily) {
- return capabilities.remove(capabitily);
- }
-
- @Override
public Set<ConnectorCapability> getCapabilities() {
return capabilities;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAExternalResource.java
----------------------------------------------------------------------
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 de3931e..393338b 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
@@ -44,6 +44,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
import org.apache.syncope.common.lib.types.TraceLevel;
import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
import org.apache.syncope.core.persistence.api.entity.ConnInstance;
@@ -153,6 +154,20 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
@Lob
private String jsonConf;
+ @NotNull
+ @Basic
+ @Min(0)
+ @Max(1)
+ private Integer overrideCapabilities;
+
+ @ElementCollection(fetch = FetchType.EAGER)
+ @Enumerated(EnumType.STRING)
+ @Column(name = "capabilityOverride")
+ @CollectionTable(name = "ExternalResource_capabilitiesOverride",
+ joinColumns =
+ @JoinColumn(name = "resource_name", referencedColumnName = "name"))
+ private Set<ConnectorCapability> capabilitiesOverride = new HashSet<>();
+
/**
* (Optional) classes for PropagationAction.
*/
@@ -163,9 +178,6 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
@JoinColumn(name = "resource_name", referencedColumnName = "name"))
private List<String> propagationActionsClassNames = new ArrayList<>();
- /**
- * Default constructor.
- */
public JPAExternalResource() {
super();
@@ -173,6 +185,7 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
propagationPrimary = 0;
propagationPriority = 0;
randomPwdIfNotProvided = 0;
+ overrideCapabilities = 0;
createTraceLevel = TraceLevel.FAILURES;
updateTraceLevel = TraceLevel.FAILURES;
@@ -357,18 +370,33 @@ public class JPAExternalResource extends AbstractAnnotatedEntity<String> impleme
}
@Override
- public Set<ConnConfProperty> getConnInstanceConfiguration() {
- Set<ConnConfProperty> configuration = new HashSet<>();
+ public Set<ConnConfProperty> getConfOverride() {
+ Set<ConnConfProperty> confOverride = new HashSet<>();
if (!StringUtils.isBlank(jsonConf)) {
- CollectionUtils.addAll(configuration, POJOHelper.deserialize(jsonConf, ConnConfProperty[].class));
+ CollectionUtils.addAll(confOverride, POJOHelper.deserialize(jsonConf, ConnConfProperty[].class));
}
- return configuration;
+ return confOverride;
+ }
+
+ @Override
+ public void setConfOverride(final Set<ConnConfProperty> confOverride) {
+ jsonConf = POJOHelper.serialize(new HashSet<>(confOverride));
+ }
+
+ @Override
+ public boolean isOverrideCapabilities() {
+ return isBooleanAsInteger(overrideCapabilities);
+ }
+
+ @Override
+ public void setOverrideCapabilities(final boolean overrideCapabilities) {
+ this.overrideCapabilities = getBooleanAsInteger(overrideCapabilities);
}
@Override
- public void setConnInstanceConfiguration(final Set<ConnConfProperty> properties) {
- jsonConf = POJOHelper.serialize(new HashSet<>(properties));
+ public Set<ConnectorCapability> getCapabilitiesOverride() {
+ return capabilitiesOverride;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/1347c108/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/DummyConnectorRegistry.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/DummyConnectorRegistry.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/DummyConnectorRegistry.java
index 91618d2..f0b892b 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/DummyConnectorRegistry.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/DummyConnectorRegistry.java
@@ -18,10 +18,7 @@
*/
package org.apache.syncope.core.persistence.jpa;
-import java.util.Set;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.provisioning.api.ConnectorRegistry;
import org.springframework.stereotype.Component;
@@ -30,15 +27,7 @@ import org.springframework.stereotype.Component;
public class DummyConnectorRegistry implements ConnectorRegistry {
@Override
- public ConnInstance getOverriddenConnInstance(
- final ConnInstance connInstance, final Set<ConnConfProperty> overridden) {
-
- return connInstance;
- }
-
- @Override
- public void registerConnector(final ExternalResource resource)
- throws NotFoundException {
+ public void registerConnector(final ExternalResource resource) throws NotFoundException {
}
@Override
[16/50] [abbrv] syncope git commit: [SYNCOPE-717] Fixing locale issue
with conversion pattern on core,
replacing SpinnerFieldPanel with new AjaxDoubleFieldPanel on console
Posted by fm...@apache.org.
[SYNCOPE-717] Fixing locale issue with conversion pattern on core, replacing SpinnerFieldPanel with new AjaxDoubleFieldPanel on console
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5954e2e7
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5954e2e7
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5954e2e7
Branch: refs/heads/SYNCOPE-156
Commit: 5954e2e7d44878c0f87d594140f6cc42146ad5c3
Parents: 893d889
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Oct 28 14:13:40 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Oct 28 14:13:40 2015 +0100
----------------------------------------------------------------------
.../console/pages/panels/AttributesPanel.java | 7 +-
.../markup/html/form/AjaxDoubleFieldPanel.java | 196 +++++++++++++++++++
.../wicket/markup/html/form/FieldPanel.java | 2 +-
.../console/SyncopeApplication.properties | 1 +
.../console/SyncopeApplication_it.properties | 1 +
.../console/SyncopeApplication_pt_BR.properties | 1 +
.../markup/html/form/AjaxDoubleFieldPanel.html | 23 +++
.../apache/syncope/core/util/DataFormat.java | 6 +-
.../syncope/core/rest/RoleTestITCase.java | 43 ++++
pom.xml | 1 +
10 files changed, 275 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
index da97a45..8e44f85 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
@@ -19,7 +19,6 @@
package org.apache.syncope.console.pages.panels;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
@@ -28,7 +27,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -52,6 +50,7 @@ import org.apache.syncope.console.rest.ConfigurationRestClient;
import org.apache.syncope.console.rest.RoleRestClient;
import org.apache.syncope.console.rest.SchemaRestClient;
import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxDoubleFieldPanel;
import org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.console.wicket.markup.html.form.BinaryFieldPanel;
@@ -318,8 +317,8 @@ public class AttributesPanel extends Panel {
break;
case Double:
- panel = new SpinnerFieldPanel<Double>("panel", schemaTO.getName(),
- Double.class, new Model<Double>(), null, null);
+ panel = new AjaxDoubleFieldPanel("panel", schemaTO.getName(), schemaTO.getConversionPattern(),
+ new Model<Double>());
if (required) {
panel.addRequiredLabel();
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
new file mode 100644
index 0000000..a5f8129
--- /dev/null
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.console.wicket.markup.html.form;
+
+import java.io.Serializable;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.ParseException;
+import java.util.List;
+import java.util.Locale;
+import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.console.SyncopeSession;
+import org.apache.syncope.console.commons.Constants;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+public class AjaxDoubleFieldPanel extends FieldPanel<Double> {
+
+ private static final long serialVersionUID = 935151916638207380L;
+
+ private static final Pattern ENGLISH_DOUBLE_PATTERN = Pattern.compile("\\d+\\.\\d+");
+
+ private static final Pattern OTHER_DOUBLE_PATTERN = Pattern.compile("\\d+,\\d+");
+
+ private final String name;
+
+ private final Pattern pattern;
+
+ private final DecimalFormat englishDf;
+
+ private final DecimalFormat localeDf;
+
+ public AjaxDoubleFieldPanel(
+ final String id, final String name, final String conversionPattern, final IModel<Double> model) {
+
+ super(id, model);
+
+ this.name = name;
+
+ this.pattern = SyncopeSession.get().getLocale().equals(Locale.ENGLISH)
+ ? ENGLISH_DOUBLE_PATTERN
+ : OTHER_DOUBLE_PATTERN;
+
+ englishDf = new DecimalFormat();
+ englishDf.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
+ if (StringUtils.isNotBlank(conversionPattern)) {
+ englishDf.applyPattern(conversionPattern);
+ }
+ localeDf = new DecimalFormat();
+ localeDf.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(SyncopeSession.get().getLocale()));
+ if (StringUtils.isNotBlank(conversionPattern)) {
+ localeDf.applyPattern(conversionPattern);
+ }
+
+ field = new TextField<Double>("doubleField", model) {
+
+ private static final long serialVersionUID = -378877047108711669L;
+
+ @Override
+ protected void convertInput() {
+ if (StringUtils.isNotBlank(getInput())) {
+ if (pattern.matcher(getInput()).matches()) {
+ Double value;
+ try {
+ value = localeDf.parse(getInput()).doubleValue();
+ setConvertedInput(value);
+ } catch (ParseException e) {
+ error(name + ": " + getString("textField.DoubleValidator"));
+ }
+ } else {
+ error(name + ": " + getString("textField.DoubleValidator"));
+ }
+ }
+ }
+ };
+ add(field.setLabel(new Model<String>(name)).setOutputMarkupId(true));
+
+ if (!isReadOnly()) {
+ field.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
+ });
+ }
+ }
+
+ @Override
+ public FieldPanel<Double> addRequiredLabel() {
+ if (!isRequired()) {
+ setRequired(true);
+ }
+
+ this.isRequiredLabelAdded = true;
+
+ return this;
+ }
+
+ @Override
+ public FieldPanel<Double> setNewModel(final List<Serializable> list) {
+ setNewModel(new Model<Double>() {
+
+ private static final long serialVersionUID = 527651414610325237L;
+
+ @Override
+ public Double getObject() {
+ Double value = null;
+
+ if (list != null && !list.isEmpty()) {
+ try {
+ value = englishDf.parse(list.get(0).toString()).doubleValue();
+ } catch (ParseException e) {
+ error(name + ": " + getString("textField.DoubleValidator"));
+ }
+ }
+
+ return value;
+ }
+
+ @Override
+ public void setObject(final Double object) {
+ list.clear();
+ if (object != null) {
+ list.add(englishDf.format(object));
+ }
+ }
+ });
+
+ return this;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public FieldPanel<Double> setNewModel(final ListItem item) {
+ IModel<Double> model = new Model<Double>() {
+
+ private static final long serialVersionUID = 6799404673615637845L;
+
+ @Override
+ public Double getObject() {
+ Double value = null;
+
+ final Object obj = item.getModelObject();
+
+ if (obj != null && !obj.toString().isEmpty()) {
+ if (obj instanceof String) {
+ try {
+ value = englishDf.parse(obj.toString()).doubleValue();
+ } catch (ParseException e) {
+ error(name + ": " + getString("textField.DoubleValidator"));
+ }
+ } else if (obj instanceof Double) {
+ // Don't parse anything
+ value = (Double) obj;
+ }
+ }
+
+ return value;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void setObject(final Double object) {
+ item.setModelObject(englishDf.format(object));
+ }
+ };
+
+ field.setModel(model);
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
index 967f369..ae02f87 100644
--- a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
@@ -126,7 +126,7 @@ public abstract class FieldPanel<T> extends AbstractFieldPanel<T> implements Clo
}
public T getModelObject() {
- return (T) field.getModelObject();
+ return field.getModelObject();
}
public FieldPanel<T> setNewModel(final IModel<T> model) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/resources/org/apache/syncope/console/SyncopeApplication.properties
----------------------------------------------------------------------
diff --git a/console/src/main/resources/org/apache/syncope/console/SyncopeApplication.properties b/console/src/main/resources/org/apache/syncope/console/SyncopeApplication.properties
index 223b27a..c733b09 100644
--- a/console/src/main/resources/org/apache/syncope/console/SyncopeApplication.properties
+++ b/console/src/main/resources/org/apache/syncope/console/SyncopeApplication.properties
@@ -52,3 +52,4 @@ jexl_ex1=surname + ',' + firstname
jexl_ex2='new.' + surname
jexl_syntax_url=Full JEXL reference
create=Create
+textField.DoubleValidator=Double value not valid
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_it.properties
----------------------------------------------------------------------
diff --git a/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_it.properties b/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_it.properties
index 3a54be5..9f3d00c 100644
--- a/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_it.properties
+++ b/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_it.properties
@@ -51,3 +51,4 @@ jexl_ex1=surname + ',' + firstname
jexl_ex2='new.' + surname
jexl_syntax_url=Sintassi JEXL completa
create=Crea
+textField.DoubleValidator=Valore double non valido
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_pt_BR.properties
----------------------------------------------------------------------
diff --git a/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_pt_BR.properties b/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_pt_BR.properties
index dd9ecd7..653983d 100644
--- a/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_pt_BR.properties
+++ b/console/src/main/resources/org/apache/syncope/console/SyncopeApplication_pt_BR.properties
@@ -51,3 +51,4 @@ jexl_ex1=sobrenome + ',' + nome
jexl_ex2='novo.' + sobrenome
jexl_syntax_url=Refer\u00eancia JEXL completa
create=Criar
+textField.DoubleValidator=Double valor n\u00e3o \u00e9 v\u00e1lido
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.html
----------------------------------------------------------------------
diff --git a/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.html b/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.html
new file mode 100644
index 0000000..050ff2d
--- /dev/null
+++ b/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxDoubleFieldPanel.html
@@ -0,0 +1,23 @@
+<!--
+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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <wicket:extend>
+ <input type="text" class="ui-widget-content ui-corner-all long_dynamicsize" wicket:id="doubleField"/>
+ </wicket:extend>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/core/src/main/java/org/apache/syncope/core/util/DataFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/util/DataFormat.java b/core/src/main/java/org/apache/syncope/core/util/DataFormat.java
index 58b719a..4296422 100644
--- a/core/src/main/java/org/apache/syncope/core/util/DataFormat.java
+++ b/core/src/main/java/org/apache/syncope/core/util/DataFormat.java
@@ -19,9 +19,11 @@
package org.apache.syncope.core.util;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.syncope.common.SyncopeConstants;
@@ -44,7 +46,9 @@ public final class DataFormat {
@Override
protected DecimalFormat initialValue() {
- return new DecimalFormat();
+ DecimalFormat df = new DecimalFormat();
+ df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
+ return df;
}
};
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
index 5f0feb0..ce553cc 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
@@ -51,6 +51,7 @@ import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.SchemaTO;
import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.AttributeSchemaType;
import org.apache.syncope.common.types.ClientExceptionType;
import org.apache.syncope.common.types.IntMappingType;
import org.apache.syncope.common.types.MappingPurpose;
@@ -886,4 +887,46 @@ public class RoleTestITCase extends AbstractTest {
resourceService.delete("new-ldap");
}
}
+
+ @Test
+ public void issueSYNCOPE717() {
+ String doubleSchemaName = "double" + getUUIDString();
+
+ // 1. create double schema without conversion pattern
+ SchemaTO schema = new SchemaTO();
+ schema.setName(doubleSchemaName);
+ schema.setType(AttributeSchemaType.Double);
+
+ schema = createSchema(AttributableType.ROLE, SchemaType.NORMAL, schema);
+ assertNotNull(schema);
+ assertNull(schema.getConversionPattern());
+
+ // 2. create role, provide valid input value
+ RoleTO roleTO = buildBasicRoleTO("syncope717");
+ roleTO.getRAttrTemplates().add(doubleSchemaName);
+ roleTO.getAttrs().add(attributeTO(doubleSchemaName, "11.23"));
+
+ roleTO = createRole(roleTO);
+ assertNotNull(roleTO);
+ assertEquals("11.23", roleTO.getAttrMap().get(doubleSchemaName).getValues().get(0));
+
+ // 3. update schema, set conversion pattern
+ schema.setConversionPattern("0.000");
+ schemaService.update(AttributableType.ROLE, SchemaType.NORMAL, schema.getName(), schema);
+
+ // 4. re-read role, verify that pattern was applied
+ roleTO = roleService.read(roleTO.getId());
+ assertNotNull(roleTO);
+ assertEquals("11.230", roleTO.getAttrMap().get(doubleSchemaName).getValues().get(0));
+
+ // 5. modify role with new double value
+ RoleMod roleMod = new RoleMod();
+ roleMod.setId(roleTO.getId());
+ roleMod.getAttrsToRemove().add(doubleSchemaName);
+ roleMod.getAttrsToUpdate().add(attributeMod(doubleSchemaName, "11.257"));
+
+ roleTO = updateRole(roleMod);
+ assertNotNull(roleTO);
+ assertEquals("11.257", roleTO.getAttrMap().get(doubleSchemaName).getValues().get(0));
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/5954e2e7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3b74d7d..65dd922 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1026,6 +1026,7 @@ under the License.
<configuration>
<source>${targetJdk}</source>
<target>${targetJdk}</target>
+ <useIncrementalCompilation>false</useIncrementalCompilation>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<!--<compilerArgument>-Xlint:unchecked</compilerArgument>-->
[17/50] [abbrv] syncope git commit: ordered set for the entitlement
Posted by fm...@apache.org.
ordered set for the entitlement
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/207d93c7
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/207d93c7
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/207d93c7
Branch: refs/heads/SYNCOPE-156
Commit: 207d93c7ceadd2d3a6798308558a81e69c6ce24e
Parents: 435e59d
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 28 15:00:39 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 28 15:00:39 2015 +0100
----------------------------------------------------------------------
.../java/org/apache/syncope/common/lib/types/Entitlement.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/207d93c7/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
index 20b8347..746a95b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import java.util.TreeSet;
public final class Entitlement {
@@ -253,7 +254,7 @@ public final class Entitlement {
private static final Set<String> ENTITLEMENTS;
static {
- Set<String> values = new HashSet<>();
+ Set<String> values = new TreeSet<>();
for (Field field : Entitlement.class.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && String.class.equals(field.getType())) {
values.add(field.getName());
[45/50] [abbrv] syncope git commit: Wrong project :-)
Posted by fm...@apache.org.
Wrong project :-)
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/214a3745
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/214a3745
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/214a3745
Branch: refs/heads/SYNCOPE-156
Commit: 214a3745866afd702dcbdc1c1fe3f3fa253135b2
Parents: 381dfde
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 30 12:02:06 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 30 12:02:06 2015 +0100
----------------------------------------------------------------------
src/site/xdoc/source-repository.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/214a3745/src/site/xdoc/source-repository.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/source-repository.xml b/src/site/xdoc/source-repository.xml
index 55f1a8f..3480189 100644
--- a/src/site/xdoc/source-repository.xml
+++ b/src/site/xdoc/source-repository.xml
@@ -40,9 +40,9 @@ under the License.
</section>
<section name="Forking on GitHub">
- <p>CXF's git repo is automatically mirrored on github at: <a href="https://github.com/apache/syncope">https://github.com/apache/syncope</a>.</p>
+ <p>Syncope's git repo is automatically mirrored on github at: <a href="https://github.com/apache/syncope">https://github.com/apache/syncope</a>.</p>
<p>You can fork that repository, commit changes to your fork, and submit pull requests through GitHub's pull request mechanisms.</p>
</section>
</body>
-</document>
\ No newline at end of file
+</document>
[30/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
index 474a3f2..fbe34d1 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInSyncProcessor.java
@@ -32,19 +32,14 @@ import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class GroupCreateInSyncProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(GroupCreateInSyncProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -59,6 +54,7 @@ public class GroupCreateInSyncProcessor implements Processor {
GroupTO groupTO = exchange.getProperty("any", GroupTO.class);
Map<Long, String> groupOwnerMap = exchange.getProperty("groupOwnerMap", Map.class);
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
AttrTO groupOwner = groupTO.getPlainAttrMap().get(StringUtils.EMPTY);
if (groupOwner != null) {
@@ -73,12 +69,7 @@ public class GroupCreateInSyncProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(created.getResult(), null));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
index b0bddef..1c08e8a 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GroupCreateProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(GroupCreateProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -54,6 +49,7 @@ public class GroupCreateProcessor implements Processor {
WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
GroupTO any = exchange.getProperty("any", GroupTO.class);
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getCreateTasks(
AnyTypeKind.GROUP,
@@ -63,12 +59,7 @@ public class GroupCreateProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(
created.getResult(), propagationReporter.getStatuses()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
index 96b328e..8603af2 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeleteProcessor.java
@@ -29,21 +29,16 @@ import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.workflow.api.GroupWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GroupDeleteProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(GroupDeleteProcessor.class);
-
@Autowired
protected GroupWorkflowAdapter gwfAdapter;
@@ -61,6 +56,7 @@ public class GroupDeleteProcessor implements Processor {
Long key = exchange.getIn().getBody(Long.class);
@SuppressWarnings("unchecked")
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = new ArrayList<>();
@@ -94,12 +90,7 @@ public class GroupDeleteProcessor implements Processor {
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.setProperty("statuses", propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
index a5c0875..dd50c45 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupDeprovisionProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.GroupDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GroupDeprovisionProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(GroupDeprovisionProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -56,6 +51,7 @@ public class GroupDeprovisionProcessor implements Processor {
public void process(final Exchange exchange) {
Long key = exchange.getIn().getBody(Long.class);
List<String> resources = exchange.getProperty("resources", List.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.DELETE, resources);
@@ -67,12 +63,7 @@ public class GroupDeprovisionProcessor implements Processor {
CollectionUtils.removeAll(groupDAO.authFind(key).getResourceNames(), resources));
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java
index b7ecc6f..def3ca3 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupProvisionProcessor.java
@@ -26,20 +26,15 @@ import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GroupProvisionProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(GroupProvisionProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -51,6 +46,7 @@ public class GroupProvisionProcessor implements Processor {
public void process(final Exchange exchange) {
Long key = exchange.getIn().getBody(Long.class);
List<String> resources = exchange.getProperty("resources", List.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, resources);
@@ -65,12 +61,7 @@ public class GroupProvisionProcessor implements Processor {
null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
index 599f54b..18aeac2 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupUpdateProcessor.java
@@ -29,7 +29,6 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
@@ -58,6 +57,7 @@ public class GroupUpdateProcessor implements Processor {
WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
GroupPatch groupPatch = exchange.getProperty("anyPatch", GroupPatch.class);
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getUpdateTasks(
AnyTypeKind.GROUP,
@@ -69,12 +69,7 @@ public class GroupUpdateProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses()));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
index 8a19609..05b2e75 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserConfirmPwdResetProcessor.java
@@ -26,20 +26,15 @@ import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserConfirmPwdResetProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserConfirmPwdResetProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -55,11 +50,6 @@ public class UserConfirmPwdResetProcessor implements Processor {
PropagationReporter propReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propReporter, false);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
index 1a9dd72..51b8e83 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserCreateProcessor.java
@@ -28,7 +28,6 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
@@ -55,6 +54,7 @@ public class UserCreateProcessor implements Processor {
WorkflowResult<Pair<Long, Boolean>> created = (WorkflowResult) exchange.getIn().getBody();
UserTO actual = exchange.getProperty("actual", UserTO.class);
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getUserCreateTasks(
created.getResult().getKey(),
@@ -65,12 +65,7 @@ public class UserCreateProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource {}", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(
new ImmutablePair<>(created.getResult().getKey(), propagationReporter.getStatuses()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
index 5838e01..328b091 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeleteProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserDeleteProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserDeleteProcessor.class);
-
@Autowired
protected UserDAO userDAO;
@@ -56,6 +51,7 @@ public class UserDeleteProcessor implements Processor {
public void process(final Exchange exchange) throws Exception {
Long key = (Long) exchange.getIn().getBody();
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.DELETE, userDAO.findAllResourceNames(userDAO.authFind(key)));
@@ -73,12 +69,7 @@ public class UserDeleteProcessor implements Processor {
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.setProperty("statuses", propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
index 522af51..2438f17 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserDeprovisionProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserDeprovisionProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserDeprovisionProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -56,6 +51,7 @@ public class UserDeprovisionProcessor implements Processor {
Long key = exchange.getIn().getBody(Long.class);
@SuppressWarnings("unchecked")
List<String> resources = exchange.getProperty("resources", List.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.set(ResourceOperation.DELETE, resources);
@@ -67,12 +63,7 @@ public class UserDeprovisionProcessor implements Processor {
CollectionUtils.removeAll(userDAO.findAllResourceNames(userDAO.authFind(key)), resources));
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java
index 04c9ac9..324d54c 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserProvisionProcessor.java
@@ -35,20 +35,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserProvisionProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserProvisionProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -65,6 +60,7 @@ public class UserProvisionProcessor implements Processor {
String password = exchange.getProperty("password", String.class);
@SuppressWarnings("unchecked")
List<String> resources = exchange.getProperty("resources", List.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
UserPatch userPatch = new UserPatch();
userPatch.setKey(key);
@@ -92,12 +88,7 @@ public class UserProvisionProcessor implements Processor {
List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(wfResult, changePwd, null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
index fbe4c20..ead8d4f 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserSetStatusInSyncProcessor.java
@@ -44,7 +44,7 @@ public class UserSetStatusInSyncProcessor implements Processor {
WorkflowResult<Map.Entry<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
Boolean enabled = exchange.getProperty("enabled", Boolean.class);
- Long key = exchange.getProperty("userKey", Long.class);
+ Long key = exchange.getProperty("key", Long.class);
if (enabled != null) {
User user = userDAO.find(key);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
index 068f003..4877140 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserStatusPropagationProcessor.java
@@ -31,20 +31,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserStatusPropagationProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserStatusPropagationProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -58,8 +53,8 @@ public class UserStatusPropagationProcessor implements Processor {
@Override
public void process(final Exchange exchange) {
WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
-
StatusPatch statusPatch = exchange.getProperty("statusPatch", StatusPatch.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, statusPatch.getResources());
@@ -74,12 +69,7 @@ public class UserStatusPropagationProcessor implements Processor {
PropagationReporter propReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propReporter.getStatuses()));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
index 8b49a5d..6c1d3a3 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateInSyncProcessor.java
@@ -28,7 +28,6 @@ import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
@@ -53,17 +52,13 @@ public class UserUpdateInSyncProcessor implements Processor {
public void process(final Exchange exchange) {
WorkflowResult<Pair<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
updated, updated.getResult().getKey().getPassword() != null, excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(
updated.getResult().getKey().getKey(), propagationReporter.getStatuses()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
index 8f175dd..57233a6 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/UserUpdateProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserUpdateProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserUpdateProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -55,16 +50,12 @@ public class UserUpdateProcessor implements Processor {
@SuppressWarnings("unchecked")
public void process(final Exchange exchange) {
WorkflowResult<Pair<UserPatch, Boolean>> updated = (WorkflowResult) exchange.getIn().getBody();
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(updated);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(
updated.getResult().getKey().getKey(), propagationReporter.getStatuses()));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
index ab3b256..41f21ad 100644
--- a/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
+++ b/ext/camel/provisioning-camel/src/main/resources/provisioning.properties
@@ -17,6 +17,10 @@
camel.directory=${conf.directory}
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml b/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml
index 38e48f3..cbf2902 100644
--- a/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml
+++ b/ext/camel/provisioning-camel/src/main/resources/userRoutes.xml
@@ -232,7 +232,7 @@ under the License.
<route id="confirmPwdReset">
<from uri="direct:confirmPwdReset"/>
<doTry>
- <bean ref="uwfAdapter" method="confirmPasswordReset(${property.userKey},${property.token},${property.password})"/>
+ <bean ref="uwfAdapter" method="confirmPasswordReset(${property.key},${property.token},${property.password})"/>
<process ref="userConfirmPwdResetProcessor"/>
<to uri="direct:confirmPwdResetPort"/>
<doCatch>
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/all/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/all/provisioning.properties b/fit/core-reference/src/main/resources/all/provisioning.properties
index 9c979a2..8147828 100644
--- a/fit/core-reference/src/main/resources/all/provisioning.properties
+++ b/fit/core-reference/src/main/resources/all/provisioning.properties
@@ -17,6 +17,10 @@
camel.directory=${conf.directory}
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.camel.CamelUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/mariadb/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/mariadb/provisioning.properties b/fit/core-reference/src/main/resources/mariadb/provisioning.properties
index ca365dc..5b6539d 100644
--- a/fit/core-reference/src/main/resources/mariadb/provisioning.properties
+++ b/fit/core-reference/src/main/resources/mariadb/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/mysql/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/mysql/provisioning.properties b/fit/core-reference/src/main/resources/mysql/provisioning.properties
index 428be67..acb8a8a 100644
--- a/fit/core-reference/src/main/resources/mysql/provisioning.properties
+++ b/fit/core-reference/src/main/resources/mysql/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/oracle/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/oracle/provisioning.properties b/fit/core-reference/src/main/resources/oracle/provisioning.properties
index a507de0..a71d41e 100644
--- a/fit/core-reference/src/main/resources/oracle/provisioning.properties
+++ b/fit/core-reference/src/main/resources/oracle/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/postgres/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/postgres/provisioning.properties b/fit/core-reference/src/main/resources/postgres/provisioning.properties
index 1be02bf..4b578ba 100644
--- a/fit/core-reference/src/main/resources/postgres/provisioning.properties
+++ b/fit/core-reference/src/main/resources/postgres/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/provisioning.properties b/fit/core-reference/src/main/resources/provisioning.properties
index a14ae19..dae8ca8 100644
--- a/fit/core-reference/src/main/resources/provisioning.properties
+++ b/fit/core-reference/src/main/resources/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/main/resources/sqlserver/provisioning.properties b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
index 4cb4b80..510eae0 100644
--- a/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
+++ b/fit/core-reference/src/main/resources/sqlserver/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
index 3e4381d..9aaf034 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AbstractITCase.java
@@ -30,6 +30,7 @@ import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.directory.InitialDirContext;
import javax.sql.DataSource;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
@@ -46,6 +47,7 @@ import org.apache.syncope.common.lib.to.AnyObjectTO;
import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RoleTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -274,34 +276,6 @@ public abstract class AbstractITCase {
return new AttrPatch.Builder().operation(PatchOperation.ADD_REPLACE).attrTO(attrTO(schema, value)).build();
}
- protected UserTO createUser(final UserTO userTO) {
- return createUser(userTO, true);
- }
-
- protected UserTO createUser(final UserTO userTO, final boolean storePassword) {
- Response response = userService.create(userTO, storePassword);
- if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
- Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
- if (ex != null) {
- throw (RuntimeException) ex;
- }
- }
- return response.readEntity(UserTO.class);
- }
-
- protected UserTO readUser(final String username) {
- return userService.read(Long.valueOf(
- userService.getUserKey(username).getHeaderString(RESTHeaders.USER_KEY)));
- }
-
- protected UserTO updateUser(final UserPatch userPatch) {
- return userService.update(userPatch).readEntity(UserTO.class);
- }
-
- protected UserTO deleteUser(final Long key) {
- return userService.delete(key).readEntity(UserTO.class);
- }
-
public <T> T getObject(final URI location, final Class<?> serviceClass, final Class<T> resultClass) {
WebClient webClient = WebClient.fromClient(WebClient.client(adminClient.getService(serviceClass)));
webClient.accept(clientFactory.getContentType().getMediaType()).to(location.toASCIIString(), false);
@@ -333,7 +307,39 @@ public abstract class AbstractITCase {
return getObject(response.getLocation(), RoleService.class, RoleTO.class);
}
- protected AnyObjectTO createAnyObject(final AnyObjectTO anyObjectTO) {
+ protected UserTO readUser(final String username) {
+ return userService.read(Long.valueOf(userService.getUserKey(username).getHeaderString(RESTHeaders.USER_KEY)));
+ }
+
+ protected ProvisioningResult<UserTO> createUser(final UserTO userTO) {
+ return createUser(userTO, true);
+ }
+
+ protected ProvisioningResult<UserTO> createUser(final UserTO userTO, final boolean storePassword) {
+ Response response = userService.create(userTO, storePassword);
+ if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
+ Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
+ if (ex != null) {
+ throw (RuntimeException) ex;
+ }
+ }
+ return response.readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ });
+ }
+
+ protected ProvisioningResult<UserTO> updateUser(final UserPatch userPatch) {
+ return userService.update(userPatch).
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ });
+ }
+
+ protected ProvisioningResult<UserTO> deleteUser(final Long key) {
+ return userService.delete(key).
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ });
+ }
+
+ protected ProvisioningResult<AnyObjectTO> createAnyObject(final AnyObjectTO anyObjectTO) {
Response response = anyObjectService.create(anyObjectTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
@@ -341,18 +347,23 @@ public abstract class AbstractITCase {
throw (RuntimeException) ex;
}
}
- return response.readEntity(AnyObjectTO.class);
+ return response.readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() {
+ });
}
- protected AnyObjectTO updateAnyObject(final AnyObjectPatch anyObjectPatch) {
- return anyObjectService.update(anyObjectPatch).readEntity(AnyObjectTO.class);
+ protected ProvisioningResult<AnyObjectTO> updateAnyObject(final AnyObjectPatch anyObjectPatch) {
+ return anyObjectService.update(anyObjectPatch).
+ readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() {
+ });
}
- protected AnyObjectTO deleteAnyObject(final Long key) {
- return anyObjectService.delete(key).readEntity(AnyObjectTO.class);
+ protected ProvisioningResult<AnyObjectTO> deleteAnyObject(final Long key) {
+ return anyObjectService.delete(key).
+ readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() {
+ });
}
- protected GroupTO createGroup(final GroupTO groupTO) {
+ protected ProvisioningResult<GroupTO> createGroup(final GroupTO groupTO) {
Response response = groupService.create(groupTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
@@ -360,15 +371,20 @@ public abstract class AbstractITCase {
throw (RuntimeException) ex;
}
}
- return response.readEntity(GroupTO.class);
+ return response.readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
+ });
}
- protected GroupTO updateGroup(final GroupPatch groupPatch) {
- return groupService.update(groupPatch).readEntity(GroupTO.class);
+ protected ProvisioningResult<GroupTO> updateGroup(final GroupPatch groupPatch) {
+ return groupService.update(groupPatch).
+ readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
+ });
}
- protected GroupTO deleteGroup(final Long key) {
- return groupService.delete(key).readEntity(GroupTO.class);
+ protected ProvisioningResult<GroupTO> deleteGroup(final Long key) {
+ return groupService.delete(key).
+ readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
+ });
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java
index 5474744..78bb011 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AnyObjectITCase.java
@@ -57,7 +57,7 @@ public class AnyObjectITCase extends AbstractITCase {
public void create() {
AnyObjectTO anyObjectTO = getSampleTO("create");
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertNotNull(anyObjectTO);
ConnObjectTO connObjectTO =
@@ -78,10 +78,10 @@ public class AnyObjectITCase extends AbstractITCase {
AnyObjectTO anyObjectTO = getSampleTO("deletable");
anyObjectTO.setRealm("/even");
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertNotNull(anyObjectTO);
- AnyObjectTO deletedAnyObject = deleteAnyObject(anyObjectTO.getKey());
+ AnyObjectTO deletedAnyObject = deleteAnyObject(anyObjectTO.getKey()).getAny();
assertNotNull(deletedAnyObject);
try {
@@ -113,7 +113,7 @@ public class AnyObjectITCase extends AbstractITCase {
@Test
public void update() {
AnyObjectTO anyObjectTO = getSampleTO("update");
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertEquals(1, anyObjectTO.getPlainAttrs().size());
@@ -122,7 +122,7 @@ public class AnyObjectITCase extends AbstractITCase {
String newLocation = "new" + getUUIDString();
anyObjectPatch.getPlainAttrs().add(attrAddReplacePatch("location", newLocation));
- anyObjectTO = updateAnyObject(anyObjectPatch);
+ anyObjectTO = updateAnyObject(anyObjectPatch).getAny();
assertEquals(newLocation, anyObjectTO.getPlainAttrMap().get("location").getValues().get(0));
}
@@ -130,7 +130,7 @@ public class AnyObjectITCase extends AbstractITCase {
@Test
public void readAttrs() {
AnyObjectTO anyObjectTO = getSampleTO("readAttrs");
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertNotNull(anyObjectTO);
Set<AttrTO> attrs = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN);
@@ -143,7 +143,7 @@ public class AnyObjectITCase extends AbstractITCase {
@Test
public void updateAttr() {
AnyObjectTO anyObjectTO = getSampleTO("updateAttr");
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertNotNull(anyObjectTO);
AttrTO updated = attrTO("location", "newlocation");
@@ -156,7 +156,7 @@ public class AnyObjectITCase extends AbstractITCase {
@Test
public void deleteAttr() {
AnyObjectTO anyObjectTO = getSampleTO("deleteAttr");
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertNotNull(anyObjectTO);
assertNotNull(anyObjectTO.getPlainAttrMap().get("location"));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
index 262d34e..e5cf78b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
@@ -28,6 +28,7 @@ import java.security.AccessControlException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
@@ -45,6 +46,7 @@ import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RoleTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
@@ -140,7 +142,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("auth@test.org");
userTO.getRoles().add(roleTO.getKey());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 3. read the schema created above (as admin) - success
@@ -170,7 +172,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("testuserread@test.org");
userTO.getRoles().add(2L);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserService userService2 = clientFactory.create(userTO.getUsername(), "password123").
@@ -195,7 +197,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("testusersearch@test.org");
userTO.getRoles().add(1L);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 1. user assigned to role 1, with search entitlement on realms /odd and /even: won't find anything with
@@ -257,7 +259,7 @@ public class AuthenticationITCase extends AbstractITCase {
// 2. as admin, create delegated admin user, and assign the role just created
UserTO delegatedAdmin = UserITCase.getUniqueSampleTO("admin@syncope.apache.org");
delegatedAdmin.getRoles().add(roleKey);
- delegatedAdmin = createUser(delegatedAdmin);
+ delegatedAdmin = createUser(delegatedAdmin).getAny();
delegatedAdminKey = delegatedAdmin.getKey();
// 3. instantiate a delegate user service client, for further operatins
@@ -279,7 +281,8 @@ public class AuthenticationITCase extends AbstractITCase {
Response response = delegatedUserService.create(user);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
- user = response.readEntity(UserTO.class);
+ user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertEquals("surname", user.getPlainAttrMap().get("surname").getValues().get(0));
// 5. as delegated, update user attempting to move under realm / -> fail
@@ -301,7 +304,8 @@ public class AuthenticationITCase extends AbstractITCase {
response = delegatedUserService.update(userPatch);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- user = response.readEntity(UserTO.class);
+ user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertEquals("surname2", user.getPlainAttrMap().get("surname").getValues().get(0));
// 7. as delegated, delete user
@@ -328,7 +332,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("checkFailedLogin@syncope.apache.org");
userTO.getRoles().add(2L);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
long userId = userTO.getKey();
@@ -354,7 +358,7 @@ public class AuthenticationITCase extends AbstractITCase {
userTO.setRealm("/odd");
userTO.getRoles().add(2L);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
long userKey = userTO.getKey();
assertNotNull(userTO);
@@ -384,7 +388,8 @@ public class AuthenticationITCase extends AbstractITCase {
StatusPatch reactivate = new StatusPatch();
reactivate.setKey(userTO.getKey());
reactivate.setType(StatusPatchType.REACTIVATE);
- userTO = userService.status(reactivate).readEntity(UserTO.class);
+ userTO = userService.status(reactivate).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("active", userTO.getStatus());
@@ -399,7 +404,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("createWithReject@syncope.apache.org");
userTO.getMemberships().add(new MembershipTO.Builder().group(9L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals("createApproval", userTO.getStatus());
@@ -437,7 +442,7 @@ public class AuthenticationITCase extends AbstractITCase {
user.setRealm("/even/two");
user.setPassword("password123");
user.getResources().add(RESOURCE_NAME_TESTDB);
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
// 2. unlink the resource from the created user
@@ -451,7 +456,7 @@ public class AuthenticationITCase extends AbstractITCase {
UserPatch userPatch = new UserPatch();
userPatch.setKey(user.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("password234").build());
- user = updateUser(userPatch);
+ user = updateUser(userPatch).getAny();
assertNotNull(user);
// 4. check that the db resource has still the initial password value
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
index 4ddcaa3..7b18109 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java
@@ -164,7 +164,7 @@ public class CamelRouteITCase extends AbstractITCase {
userTO.getPlainAttrs().add(attrTO("surname", userId));
userTO.getPlainAttrs().add(attrTO("camelAttribute", "false"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals("true", CollectionUtils.get(userTO.getPlainAttrs(), 3).getValues().get(0));
} finally {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
index 17ba8c8..3ddb2c8 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@ -34,6 +34,7 @@ import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
@@ -61,6 +62,7 @@ import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.AttrSchemaType;
@@ -85,7 +87,7 @@ public class GroupITCase extends AbstractITCase {
public static GroupTO getBasicSampleTO(final String name) {
GroupTO groupTO = new GroupTO();
- groupTO.setRealm("/");
+ groupTO.setRealm(SyncopeConstants.ROOT_REALM);
groupTO.setName(name + getUUIDString());
return groupTO;
}
@@ -105,7 +107,7 @@ public class GroupITCase extends AbstractITCase {
groupTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue"));
groupTO.setGroupOwner(8L);
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
assertNotNull(groupTO.getVirAttrMap());
@@ -125,7 +127,7 @@ public class GroupITCase extends AbstractITCase {
groupPatch.setKey(groupTO.getKey());
groupPatch.setGroupOwner(new LongReplacePatchItem());
- assertNull(updateGroup(groupPatch).getGroupOwner());
+ assertNull(updateGroup(groupPatch).getAny().getGroupOwner());
}
@Test
@@ -142,10 +144,10 @@ public class GroupITCase extends AbstractITCase {
groupTO.getResources().add(RESOURCE_NAME_LDAP);
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
- GroupTO deletedGroup = deleteGroup(groupTO.getKey());
+ GroupTO deletedGroup = deleteGroup(groupTO.getKey()).getAny();
assertNotNull(deletedGroup);
try {
@@ -206,7 +208,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void update() {
GroupTO groupTO = getSampleTO("latestGroup" + getUUIDString());
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertEquals(1, groupTO.getPlainAttrs().size());
@@ -216,7 +218,7 @@ public class GroupITCase extends AbstractITCase {
groupPatch.setName(new StringReplacePatchItem.Builder().value(modName).build());
groupPatch.getPlainAttrs().add(attrAddReplacePatch("show", "FALSE"));
- groupTO = updateGroup(groupPatch);
+ groupTO = updateGroup(groupPatch).getAny();
assertEquals(modName, groupTO.getName());
assertEquals(2, groupTO.getPlainAttrs().size());
@@ -227,7 +229,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = getBasicSampleTO("withderived" + getUUIDString());
groupTO.getDerAttrs().add(attrTO("rderivedschema", null));
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
assertEquals(1, groupTO.getDerAttrs().size());
@@ -238,7 +240,7 @@ public class GroupITCase extends AbstractITCase {
attrTO(new AttrTO.Builder().schema("rderivedschema").build()).
build());
- groupTO = updateGroup(groupPatch);
+ groupTO = updateGroup(groupPatch).getAny();
assertNotNull(groupTO);
assertTrue(groupTO.getDerAttrs().isEmpty());
}
@@ -274,7 +276,8 @@ public class GroupITCase extends AbstractITCase {
// 4. update as puccini, owner of group 6 - success
GroupService groupService3 = clientFactory.create("puccini", ADMIN_PWD).getService(GroupService.class);
- groupTO = groupService3.update(groupPatch).readEntity(GroupTO.class);
+ groupTO = groupService3.update(groupPatch).readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
+ }).getAny();
assertEquals("Director", groupTO.getName());
// issue SYNCOPE-15
@@ -292,7 +295,7 @@ public class GroupITCase extends AbstractITCase {
groupTO.setName(groupName);
groupTO.setRealm("/");
- GroupTO actual = createGroup(groupTO);
+ GroupTO actual = createGroup(groupTO).getAny();
assertNotNull(actual);
assertEquals(groupName, actual.getName());
@@ -302,14 +305,14 @@ public class GroupITCase extends AbstractITCase {
String renamedGroup = "renamed" + getUUIDString();
groupPatch.setName(new StringReplacePatchItem.Builder().value(renamedGroup).build());
- actual = updateGroup(groupPatch);
+ actual = updateGroup(groupPatch).getAny();
assertNotNull(actual);
assertEquals(renamedGroup, actual.getName());
}
@Test
public void unlink() {
- GroupTO actual = createGroup(getSampleTO("unlink"));
+ GroupTO actual = createGroup(getSampleTO("unlink")).getAny();
assertNotNull(actual);
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
@@ -333,7 +336,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = getSampleTO("link");
groupTO.getResources().clear();
- GroupTO actual = createGroup(groupTO);
+ GroupTO actual = createGroup(groupTO).getAny();
assertNotNull(actual);
try {
@@ -363,7 +366,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void unassign() {
- GroupTO actual = createGroup(getSampleTO("unassign"));
+ GroupTO actual = createGroup(getSampleTO("unassign")).getAny();
assertNotNull(actual);
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
@@ -392,7 +395,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = getSampleTO("assign");
groupTO.getResources().clear();
- GroupTO actual = createGroup(groupTO);
+ GroupTO actual = createGroup(groupTO).getAny();
assertNotNull(actual);
try {
@@ -416,7 +419,7 @@ public class GroupITCase extends AbstractITCase {
@Test
public void deprovision() {
- GroupTO actual = createGroup(getSampleTO("deprovision"));
+ GroupTO actual = createGroup(getSampleTO("deprovision")).getAny();
assertNotNull(actual);
assertNotNull(actual.getKey());
@@ -446,7 +449,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = getSampleTO("assign" + getUUIDString());
groupTO.getResources().clear();
- GroupTO actual = createGroup(groupTO);
+ GroupTO actual = createGroup(groupTO).getAny();
assertNotNull(actual);
try {
@@ -474,7 +477,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = getSampleTO("assign" + getUUIDString());
groupTO.getResources().clear();
- GroupTO actual = createGroup(groupTO);
+ GroupTO actual = createGroup(groupTO).getAny();
assertNotNull(actual);
try {
@@ -526,7 +529,7 @@ public class GroupITCase extends AbstractITCase {
// 2. create a group *without* an attribute for that schema: it works
GroupTO groupTO = getSampleTO("lastGroup");
assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
@@ -554,7 +557,7 @@ public class GroupITCase extends AbstractITCase {
// 5. also add an actual attribute for badge - it will work
groupPatch.getPlainAttrs().add(attrAddReplacePatch(badge.getKey(), "xxxxxxxxxx"));
- groupTO = updateGroup(groupPatch);
+ groupTO = updateGroup(groupPatch).getAny();
assertNotNull(groupTO);
assertTrue(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
} finally {
@@ -619,7 +622,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO group = getBasicSampleTO("dynMembership");
group.setUDynMembershipCond("cool==true");
- group = createGroup(group);
+ group = createGroup(group).getAny();
assertNotNull(group);
assertTrue(userService.read(4L).getDynGroups().contains(group.getKey()));
@@ -652,11 +655,12 @@ public class GroupITCase extends AbstractITCase {
group.getPlainAttrs().add(attrTO("title", "first"));
group.getResources().add(RESOURCE_NAME_LDAP);
- group = createGroup(group);
- assertNotNull(group);
- assertEquals(1, group.getPropagationStatusTOs().size());
- assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+ ProvisioningResult<GroupTO> result = createGroup(group);
+ assertNotNull(result);
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ group = result.getAny();
// 2. update succeeds
GroupPatch patch = new GroupPatch();
@@ -664,11 +668,12 @@ public class GroupITCase extends AbstractITCase {
patch.getPlainAttrs().add(new AttrPatch.Builder().
operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "second")).build());
- group = groupService.update(patch).readEntity(GroupTO.class);
- assertNotNull(group);
- assertEquals(1, group.getPropagationStatusTOs().size());
- assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+ result = updateGroup(patch);
+ assertNotNull(result);
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ group = result.getAny();
// 3. set capability override with only search allowed, but not enable
ldap.getCapabilitiesOverride().add(ConnectorCapability.SEARCH);
@@ -685,11 +690,12 @@ public class GroupITCase extends AbstractITCase {
patch.getPlainAttrs().add(new AttrPatch.Builder().
operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "third")).build());
- group = groupService.update(patch).readEntity(GroupTO.class);
- assertNotNull(group);
- assertEquals(1, group.getPropagationStatusTOs().size());
- assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+ result = updateGroup(patch);
+ assertNotNull(result);
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ group = result.getAny();
// 5. enable capability override
ldap.setOverrideCapabilities(true);
@@ -706,11 +712,11 @@ public class GroupITCase extends AbstractITCase {
patch.getPlainAttrs().add(new AttrPatch.Builder().
operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "fourth")).build());
- group = groupService.update(patch).readEntity(GroupTO.class);
- assertNotNull(group);
- assertEquals(1, group.getPropagationStatusTOs().size());
- assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, group.getPropagationStatusTOs().get(0).getStatus());
+ result = updateGroup(patch);
+ assertNotNull(result);
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, result.getPropagationStatuses().get(0).getStatus());
} finally {
ldap.getCapabilitiesOverride().clear();
ldap.setOverrideCapabilities(false);
@@ -725,7 +731,7 @@ public class GroupITCase extends AbstractITCase {
// 1. create new LDAP resource having ConnObjectKey mapped to a derived attribute
ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP);
newLDAP.setKey("new-ldap");
- newLDAP.setPropagationPrimary(true);
+ newLDAP.setPropagationPriority(0);
for (ProvisionTO provision : newLDAP.getProvisions()) {
provision.getVirSchemas().clear();
@@ -756,7 +762,7 @@ public class GroupITCase extends AbstractITCase {
groupTO.getResources().clear();
groupTO.getResources().add("new-ldap");
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
// 3. update the group
@@ -764,7 +770,7 @@ public class GroupITCase extends AbstractITCase {
groupPatch.setKey(groupTO.getKey());
groupPatch.getPlainAttrs().add(attrAddReplacePatch("icon", "anotherIcon"));
- groupTO = updateGroup(groupPatch);
+ groupTO = updateGroup(groupPatch).getAny();
assertNotNull(groupTO);
// 4. check that a single group exists in LDAP for the group created and updated above
@@ -826,7 +832,7 @@ public class GroupITCase extends AbstractITCase {
GroupTO groupTO = getBasicSampleTO("syncope717");
groupTO.getPlainAttrs().add(attrTO(doubleSchemaName, "11.23"));
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
@@ -844,7 +850,7 @@ public class GroupITCase extends AbstractITCase {
patch.setKey(groupTO.getKey());
patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.257")).build());
- groupTO = updateGroup(patch);
+ groupTO = updateGroup(patch).getAny();
assertNotNull(groupTO);
assertEquals("11.257", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
@@ -857,7 +863,7 @@ public class GroupITCase extends AbstractITCase {
patch.setKey(groupTO.getKey());
patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.23")).build());
- groupTO = updateGroup(patch);
+ groupTO = updateGroup(patch).getAny();
assertNotNull(groupTO);
assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
}
[24/50] [abbrv] syncope git commit: [SYNCOPE-717] Merge from 1_2_X
Posted by fm...@apache.org.
[SYNCOPE-717] Merge from 1_2_X
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e486aaf3
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e486aaf3
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e486aaf3
Branch: refs/heads/SYNCOPE-156
Commit: e486aaf3a1ac1b5a3281a2c93598cc38cca4073e
Parents: 0211410 5954e2e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Oct 29 10:37:23 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Oct 29 10:39:43 2015 +0100
----------------------------------------------------------------------
.../syncope/core/misc/utils/FormatUtils.java | 6 +-
.../syncope/fit/core/reference/GroupITCase.java | 59 ++++++++++++++++++++
2 files changed, 64 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/e486aaf3/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
----------------------------------------------------------------------
diff --cc core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
index ec5250a,0000000..131f310
mode 100644,000000..100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/utils/FormatUtils.java
@@@ -1,117 -1,0 +1,121 @@@
+/*
+ * 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.core.misc.utils;
+
+import java.text.DecimalFormat;
++import java.text.DecimalFormatSymbols;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
++import java.util.Locale;
+import org.apache.commons.lang3.time.DateUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+
+/**
+ * Utility class for parsing / formatting date and numbers.
+ */
+public final class FormatUtils {
+
+ private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
+
+ @Override
+ protected SimpleDateFormat initialValue() {
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ sdf.applyPattern(SyncopeConstants.DEFAULT_DATE_PATTERN);
+ return sdf;
+ }
+ };
+
+ private static final ThreadLocal<DecimalFormat> DECIMAL_FORMAT = new ThreadLocal<DecimalFormat>() {
+
+ @Override
+ protected DecimalFormat initialValue() {
- return new DecimalFormat();
++ DecimalFormat df = new DecimalFormat();
++ df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
++ return df;
+ }
+ };
+
+ public static String format(final Date date) {
+ return format(date, true);
+ }
+
+ public static String format(final Date date, final boolean lenient) {
+ return format(date, lenient, null);
+ }
+
+ public static String format(final Date date, final boolean lenient, final String conversionPattern) {
+ SimpleDateFormat sdf = DATE_FORMAT.get();
+ if (conversionPattern != null) {
+ sdf.applyPattern(conversionPattern);
+ }
+ sdf.setLenient(lenient);
+ return sdf.format(date);
+ }
+
+ public static String format(final long number) {
+ return format(number, null);
+ }
+
+ public static String format(final long number, final String conversionPattern) {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ if (conversionPattern != null) {
+ df.applyPattern(conversionPattern);
+ }
+ return df.format(number);
+ }
+
+ public static String format(final double number) {
+ return format(number, null);
+ }
+
+ public static String format(final double number, final String conversionPattern) {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ if (conversionPattern != null) {
+ df.applyPattern(conversionPattern);
+ }
+ return df.format(number);
+ }
+
+ public static Date parseDate(final String source) throws ParseException {
+ return DateUtils.parseDate(source, SyncopeConstants.DATE_PATTERNS);
+ }
+
+ public static Date parseDate(final String source, final String conversionPattern) throws ParseException {
+ SimpleDateFormat sdf = DATE_FORMAT.get();
+ sdf.applyPattern(conversionPattern);
+ sdf.setLenient(false);
+ return sdf.parse(source);
+ }
+
+ public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ df.applyPattern(conversionPattern);
+ return df.parse(source);
+ }
+
+ public static void clear() {
+ DATE_FORMAT.remove();
+ DECIMAL_FORMAT.remove();
+ }
+
+ private FormatUtils() {
+ // private empty constructor
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/e486aaf3/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
----------------------------------------------------------------------
diff --cc fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
index db12a2b,0000000..17ba8c8
mode 100644,000000..100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java
@@@ -1,806 -1,0 +1,865 @@@
+/*
+ * 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.fit.core.reference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessControlException;
+import java.util.List;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.patch.AssociationPatch;
+import org.apache.syncope.common.lib.patch.AttrPatch;
+import org.apache.syncope.common.lib.patch.DeassociationPatch;
+import org.apache.syncope.common.lib.patch.GroupPatch;
+import org.apache.syncope.common.lib.patch.LongReplacePatchItem;
+import org.apache.syncope.common.lib.patch.StringReplacePatchItem;
+import org.apache.syncope.common.lib.to.AnyTypeClassTO;
+import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.MappingItemTO;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.MappingTO;
+import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
++import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.common.lib.types.PatchOperation;
+import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
+import org.apache.syncope.common.lib.types.ResourceAssociationAction;
+import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.Preference;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.GroupService;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.JVM)
+public class GroupITCase extends AbstractITCase {
+
+ public static GroupTO getBasicSampleTO(final String name) {
+ GroupTO groupTO = new GroupTO();
+ groupTO.setRealm("/");
+ groupTO.setName(name + getUUIDString());
+ return groupTO;
+ }
+
+ public static GroupTO getSampleTO(final String name) {
+ GroupTO groupTO = getBasicSampleTO(name);
+
+ groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
+
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
+ return groupTO;
+ }
+
+ @Test
+ public void create() {
+ GroupTO groupTO = getSampleTO("lastGroup");
+ groupTO.getVirAttrs().add(attrTO("rvirtualdata", "rvirtualvalue"));
+ groupTO.setGroupOwner(8L);
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+
+ assertNotNull(groupTO.getVirAttrMap());
+ assertNotNull(groupTO.getVirAttrMap().get("rvirtualdata").getValues());
+ assertFalse(groupTO.getVirAttrMap().get("rvirtualdata").getValues().isEmpty());
+ assertEquals("rvirtualvalue", groupTO.getVirAttrMap().get("rvirtualdata").getValues().get(0));
+
+ assertTrue(groupTO.getResources().contains(RESOURCE_NAME_LDAP));
+
+ ConnObjectTO connObjectTO =
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey());
+ assertNotNull(connObjectTO);
+ assertNotNull(connObjectTO.getPlainAttrMap().get("owner"));
+
+ // SYNCOPE-515: remove ownership
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(groupTO.getKey());
+ groupPatch.setGroupOwner(new LongReplacePatchItem());
+
+ assertNull(updateGroup(groupPatch).getGroupOwner());
+ }
+
+ @Test
+ public void delete() {
+ try {
+ groupService.delete(0L);
+ } catch (SyncopeClientException e) {
+ assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
+ }
+
+ GroupTO groupTO = new GroupTO();
+ groupTO.setName("toBeDeleted" + getUUIDString());
+ groupTO.setRealm("/even");
+
+ groupTO.getResources().add(RESOURCE_NAME_LDAP);
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+
+ GroupTO deletedGroup = deleteGroup(groupTO.getKey());
+ assertNotNull(deletedGroup);
+
+ try {
+ groupService.read(deletedGroup.getKey());
+ } catch (SyncopeClientException e) {
+ assertEquals(Response.Status.NOT_FOUND, e.getType().getResponseStatus());
+ }
+ }
+
+ @Test
+ public void list() {
+ PagedResult<GroupTO> groupTOs =
+ groupService.list(SyncopeClient.getAnyListQueryBuilder().realm(SyncopeConstants.ROOT_REALM).build());
+ assertNotNull(groupTOs);
+ assertTrue(groupTOs.getResult().size() >= 8);
+ for (GroupTO groupTO : groupTOs.getResult()) {
+ assertNotNull(groupTO);
+ }
+ }
+
+ @Test
+ public void read() {
+ GroupTO groupTO = groupService.read(1L);
+
+ assertNotNull(groupTO);
+ assertNotNull(groupTO.getPlainAttrs());
+ assertFalse(groupTO.getPlainAttrs().isEmpty());
+ }
+
+ @Test
+ public void selfRead() {
+ UserTO userTO = userService.read(1L);
+ assertNotNull(userTO);
+
+ assertTrue(userTO.getMembershipMap().containsKey(1L));
+ assertFalse(userTO.getMembershipMap().containsKey(3L));
+
+ GroupService groupService2 = clientFactory.create("rossini", ADMIN_PWD).getService(GroupService.class);
+
+ try {
+ groupService2.read(3L);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.DelegatedAdministration, e.getType());
+ }
+
+ List<GroupTO> groups = groupService2.own();
+ assertNotNull(groups);
+ assertTrue(CollectionUtils.exists(groups, new Predicate<GroupTO>() {
+
+ @Override
+ public boolean evaluate(final GroupTO group) {
+ return 1L == group.getKey();
+ }
+ }));
+ }
+
+ @Test
+ public void update() {
+ GroupTO groupTO = getSampleTO("latestGroup" + getUUIDString());
+ groupTO = createGroup(groupTO);
+
+ assertEquals(1, groupTO.getPlainAttrs().size());
+
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(groupTO.getKey());
+ String modName = "finalGroup" + getUUIDString();
+ groupPatch.setName(new StringReplacePatchItem.Builder().value(modName).build());
+ groupPatch.getPlainAttrs().add(attrAddReplacePatch("show", "FALSE"));
+
+ groupTO = updateGroup(groupPatch);
+
+ assertEquals(modName, groupTO.getName());
+ assertEquals(2, groupTO.getPlainAttrs().size());
+ }
+
+ @Test
+ public void updateRemovingDerAttribute() {
+ GroupTO groupTO = getBasicSampleTO("withderived" + getUUIDString());
+ groupTO.getDerAttrs().add(attrTO("rderivedschema", null));
+
+ groupTO = createGroup(groupTO);
+
+ assertNotNull(groupTO);
+ assertEquals(1, groupTO.getDerAttrs().size());
+
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(groupTO.getKey());
+ groupPatch.getDerAttrs().add(new AttrPatch.Builder().operation(PatchOperation.DELETE).
+ attrTO(new AttrTO.Builder().schema("rderivedschema").build()).
+ build());
+
+ groupTO = updateGroup(groupPatch);
+ assertNotNull(groupTO);
+ assertTrue(groupTO.getDerAttrs().isEmpty());
+ }
+
+ @Test
+ public void updateAsGroupOwner() {
+ // 1. read group as admin
+ GroupTO groupTO = groupService.read(6L);
+
+ // issue SYNCOPE-15
+ assertNotNull(groupTO.getCreationDate());
+ assertNotNull(groupTO.getLastChangeDate());
+ assertEquals("admin", groupTO.getCreator());
+ assertEquals("admin", groupTO.getLastModifier());
+
+ // 2. prepare update
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(groupTO.getKey());
+ groupPatch.setName(new StringReplacePatchItem.Builder().value("Director").build());
+
+ // 3. try to update as verdi, not owner of group 6 - fail
+ GroupService groupService2 = clientFactory.create("verdi", ADMIN_PWD).getService(GroupService.class);
+
+ try {
+ groupService2.update(groupPatch);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(Response.Status.UNAUTHORIZED, e.getType().getResponseStatus());
+ } catch (AccessControlException e) {
+ assertNotNull(e);
+ }
+
+ // 4. update as puccini, owner of group 6 - success
+ GroupService groupService3 = clientFactory.create("puccini", ADMIN_PWD).getService(GroupService.class);
+
+ groupTO = groupService3.update(groupPatch).readEntity(GroupTO.class);
+ assertEquals("Director", groupTO.getName());
+
+ // issue SYNCOPE-15
+ assertNotNull(groupTO.getCreationDate());
+ assertNotNull(groupTO.getLastChangeDate());
+ assertEquals("admin", groupTO.getCreator());
+ assertEquals("puccini", groupTO.getLastModifier());
+ assertTrue(groupTO.getCreationDate().before(groupTO.getLastChangeDate()));
+ }
+
+ @Test
+ public void issue178() {
+ GroupTO groupTO = new GroupTO();
+ String groupName = "torename" + getUUIDString();
+ groupTO.setName(groupName);
+ groupTO.setRealm("/");
+
+ GroupTO actual = createGroup(groupTO);
+
+ assertNotNull(actual);
+ assertEquals(groupName, actual.getName());
+
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(actual.getKey());
+ String renamedGroup = "renamed" + getUUIDString();
+ groupPatch.setName(new StringReplacePatchItem.Builder().value(renamedGroup).build());
+
+ actual = updateGroup(groupPatch);
+ assertNotNull(actual);
+ assertEquals(renamedGroup, actual.getName());
+ }
+
+ @Test
+ public void unlink() {
+ GroupTO actual = createGroup(getSampleTO("unlink"));
+ assertNotNull(actual);
+
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+
+ DeassociationPatch deassociationPatch = new DeassociationPatch();
+ deassociationPatch.setKey(actual.getKey());
+ deassociationPatch.setAction(ResourceDeassociationAction.UNLINK);
+ deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertTrue(actual.getResources().isEmpty());
+
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+ }
+
+ @Test
+ public void link() {
+ GroupTO groupTO = getSampleTO("link");
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ AssociationPatch associationPatch = new AssociationPatch();
+ associationPatch.setKey(actual.getKey());
+ associationPatch.setAction(ResourceAssociationAction.LINK);
+ associationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertFalse(actual.getResources().isEmpty());
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void unassign() {
+ GroupTO actual = createGroup(getSampleTO("unassign"));
+ assertNotNull(actual);
+
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+
+ DeassociationPatch deassociationPatch = new DeassociationPatch();
+ deassociationPatch.setKey(actual.getKey());
+ deassociationPatch.setAction(ResourceDeassociationAction.UNASSIGN);
+ deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertTrue(actual.getResources().isEmpty());
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void assign() {
+ GroupTO groupTO = getSampleTO("assign");
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ AssociationPatch associationPatch = new AssociationPatch();
+ associationPatch.setKey(actual.getKey());
+ associationPatch.setAction(ResourceAssociationAction.ASSIGN);
+ associationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertFalse(actual.getResources().isEmpty());
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+ }
+
+ @Test
+ public void deprovision() {
+ GroupTO actual = createGroup(getSampleTO("deprovision"));
+ assertNotNull(actual);
+ assertNotNull(actual.getKey());
+
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+
+ DeassociationPatch deassociationPatch = new DeassociationPatch();
+ deassociationPatch.setKey(actual.getKey());
+ deassociationPatch.setAction(ResourceDeassociationAction.DEPROVISION);
+ deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertFalse(actual.getResources().isEmpty());
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void provision() {
+ GroupTO groupTO = getSampleTO("assign" + getUUIDString());
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ AssociationPatch associationPatch = new AssociationPatch();
+ associationPatch.setKey(actual.getKey());
+ associationPatch.setAction(ResourceAssociationAction.PROVISION);
+ associationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertTrue(actual.getResources().isEmpty());
+
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+ }
+
+ @Test
+ public void deprovisionUnlinked() {
+ GroupTO groupTO = getSampleTO("assign" + getUUIDString());
+ groupTO.getResources().clear();
+
+ GroupTO actual = createGroup(groupTO);
+ assertNotNull(actual);
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+
+ AssociationPatch associationPatch = new AssociationPatch();
+ associationPatch.setKey(actual.getKey());
+ associationPatch.setAction(ResourceAssociationAction.PROVISION);
+ associationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertTrue(actual.getResources().isEmpty());
+
+ assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey()));
+
+ DeassociationPatch deassociationPatch = new DeassociationPatch();
+ deassociationPatch.setKey(actual.getKey());
+ deassociationPatch.setAction(ResourceDeassociationAction.DEPROVISION);
+ deassociationPatch.getResources().add(RESOURCE_NAME_LDAP);
+
+ assertNotNull(groupService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
+
+ actual = groupService.read(actual.getKey());
+ assertNotNull(actual);
+ assertTrue(actual.getResources().isEmpty());
+
+ try {
+ resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), actual.getKey());
+ fail();
+ } catch (Exception e) {
+ assertNotNull(e);
+ }
+ }
+
+ @Test
+ public void createWithMandatorySchema() {
+ // 1. create a mandatory schema
+ PlainSchemaTO badge = new PlainSchemaTO();
+ badge.setKey("badge" + getUUIDString());
+ badge.setMandatoryCondition("true");
+ schemaService.create(SchemaType.PLAIN, badge);
+
+ // 2. create a group *without* an attribute for that schema: it works
+ GroupTO groupTO = getSampleTO("lastGroup");
+ assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+ assertFalse(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
+
+ // 3. add the new mandatory schema to the default group type
+ AnyTypeTO type = anyTypeService.read(AnyTypeKind.GROUP.name());
+ String typeClassName = type.getClasses().get(0);
+ AnyTypeClassTO typeClass = anyTypeClassService.read(typeClassName);
+ typeClass.getPlainSchemas().add(badge.getKey());
+ anyTypeClassService.update(typeClass);
+ typeClass = anyTypeClassService.read(typeClassName);
+ assertTrue(typeClass.getPlainSchemas().contains(badge.getKey()));
+
+ try {
+ // 4. update group: failure since no values are provided and it is mandatory
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(groupTO.getKey());
+
+ try {
+ updateGroup(groupPatch);
+ fail();
+ } catch (SyncopeClientException e) {
+ assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
+ }
+
+ // 5. also add an actual attribute for badge - it will work
+ groupPatch.getPlainAttrs().add(attrAddReplacePatch(badge.getKey(), "xxxxxxxxxx"));
+
+ groupTO = updateGroup(groupPatch);
+ assertNotNull(groupTO);
+ assertTrue(groupTO.getPlainAttrMap().containsKey(badge.getKey()));
+ } finally {
+ // restore the original group class
+ typeClass.getPlainSchemas().remove(badge.getKey());
+ anyTypeClassService.update(typeClass);
+ typeClass = anyTypeClassService.read(typeClassName);
+ assertFalse(typeClass.getPlainSchemas().contains(badge.getKey()));
+ }
+ }
+
+ @Test
+ public void anonymous() {
+ GroupService unauthenticated = clientFactory.create().getService(GroupService.class);
+ try {
+ unauthenticated.
+ list(SyncopeClient.getAnySearchQueryBuilder().realm(SyncopeConstants.ROOT_REALM).build());
+ fail();
+ } catch (AccessControlException e) {
+ assertNotNull(e);
+ }
+
+ GroupService anonymous = clientFactory.create(ANONYMOUS_UNAME, ANONYMOUS_KEY).getService(GroupService.class);
+ assertFalse(anonymous.list(SyncopeClient.getAnySearchQueryBuilder().realm(SyncopeConstants.ROOT_REALM).
+ build()).
+ getResult().isEmpty());
+ }
+
+ @Test
+ public void noContent() throws IOException {
+ SyncopeClient noContentclient = clientFactory.create(ADMIN_UNAME, ADMIN_PWD);
+ GroupService noContentService = noContentclient.prefer(GroupService.class, Preference.RETURN_NO_CONTENT);
+
+ GroupTO group = getSampleTO("noContent");
+
+ Response response = noContentService.create(group);
+ assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
+ assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
+ assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
+
+ group = getObject(response.getLocation(), GroupService.class, GroupTO.class);
+ assertNotNull(group);
+
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(group.getKey());
+ groupPatch.getPlainAttrs().add(attrAddReplacePatch("badge", "xxxxxxxxxx"));
+
+ response = noContentService.update(groupPatch);
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
+ assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
+
+ response = noContentService.delete(group.getKey());
+ assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
+ assertEquals(Preference.RETURN_NO_CONTENT.toString(), response.getHeaderString(RESTHeaders.PREFERENCE_APPLIED));
+ assertEquals(StringUtils.EMPTY, IOUtils.toString((InputStream) response.getEntity()));
+ }
+
+ @Test
+ public void dynMembership() {
+ assertTrue(userService.read(4L).getDynGroups().isEmpty());
+
+ GroupTO group = getBasicSampleTO("dynMembership");
+ group.setUDynMembershipCond("cool==true");
+ group = createGroup(group);
+ assertNotNull(group);
+
+ assertTrue(userService.read(4L).getDynGroups().contains(group.getKey()));
+
+ GroupPatch mod = new GroupPatch();
+ mod.setKey(group.getKey());
+ mod.setUDynMembershipCond(new StringReplacePatchItem.Builder().value("cool==false").build());
+ groupService.update(mod);
+
+ assertTrue(userService.read(4L).getDynGroups().isEmpty());
+ }
+
+ @Test
+ public void capabilitiesOverride() {
+ // resource with no capability override
+ ResourceTO ldap = resourceService.read(RESOURCE_NAME_LDAP);
+ assertNotNull(ldap);
+ assertFalse(ldap.isOverrideCapabilities());
+ assertTrue(ldap.getCapabilitiesOverride().isEmpty());
+
+ // connector with all required for create and update
+ ConnInstanceTO conn = connectorService.read(ldap.getConnector(), null);
+ assertNotNull(conn);
+ assertTrue(conn.getCapabilities().contains(ConnectorCapability.CREATE));
+ assertTrue(conn.getCapabilities().contains(ConnectorCapability.UPDATE));
+
+ try {
+ // 1. create succeeds
+ GroupTO group = getSampleTO("syncope714");
+ group.getPlainAttrs().add(attrTO("title", "first"));
+ group.getResources().add(RESOURCE_NAME_LDAP);
+
+ group = createGroup(group);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+
+ // 2. update succeeds
+ GroupPatch patch = new GroupPatch();
+ patch.setKey(group.getKey());
+ patch.getPlainAttrs().add(new AttrPatch.Builder().
+ operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "second")).build());
+
+ group = groupService.update(patch).readEntity(GroupTO.class);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+
+ // 3. set capability override with only search allowed, but not enable
+ ldap.getCapabilitiesOverride().add(ConnectorCapability.SEARCH);
+ resourceService.update(ldap);
+ ldap = resourceService.read(RESOURCE_NAME_LDAP);
+ assertNotNull(ldap);
+ assertFalse(ldap.isOverrideCapabilities());
+ assertEquals(1, ldap.getCapabilitiesOverride().size());
+ assertTrue(ldap.getCapabilitiesOverride().contains(ConnectorCapability.SEARCH));
+
+ // 4. update succeeds again
+ patch = new GroupPatch();
+ patch.setKey(group.getKey());
+ patch.getPlainAttrs().add(new AttrPatch.Builder().
+ operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "third")).build());
+
+ group = groupService.update(patch).readEntity(GroupTO.class);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, group.getPropagationStatusTOs().get(0).getStatus());
+
+ // 5. enable capability override
+ ldap.setOverrideCapabilities(true);
+ resourceService.update(ldap);
+ ldap = resourceService.read(RESOURCE_NAME_LDAP);
+ assertNotNull(ldap);
+ assertTrue(ldap.isOverrideCapabilities());
+ assertEquals(1, ldap.getCapabilitiesOverride().size());
+ assertTrue(ldap.getCapabilitiesOverride().contains(ConnectorCapability.SEARCH));
+
+ // 6. update now fails
+ patch = new GroupPatch();
+ patch.setKey(group.getKey());
+ patch.getPlainAttrs().add(new AttrPatch.Builder().
+ operation(PatchOperation.ADD_REPLACE).attrTO(attrTO("title", "fourth")).build());
+
+ group = groupService.update(patch).readEntity(GroupTO.class);
+ assertNotNull(group);
+ assertEquals(1, group.getPropagationStatusTOs().size());
+ assertEquals(RESOURCE_NAME_LDAP, group.getPropagationStatusTOs().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED, group.getPropagationStatusTOs().get(0).getStatus());
+ } finally {
+ ldap.getCapabilitiesOverride().clear();
+ ldap.setOverrideCapabilities(false);
+ resourceService.update(ldap);
+ }
+ }
+
+ @Test
+ public void issueSYNCOPE632() {
+ GroupTO groupTO = null;
+ try {
+ // 1. create new LDAP resource having ConnObjectKey mapped to a derived attribute
+ ResourceTO newLDAP = resourceService.read(RESOURCE_NAME_LDAP);
+ newLDAP.setKey("new-ldap");
+ newLDAP.setPropagationPrimary(true);
+
+ for (ProvisionTO provision : newLDAP.getProvisions()) {
+ provision.getVirSchemas().clear();
+ }
+
+ MappingTO mapping = newLDAP.getProvision(AnyTypeKind.GROUP.name()).getMapping();
+
+ MappingItemTO connObjectKey = mapping.getConnObjectKeyItem();
+ connObjectKey.setIntMappingType(IntMappingType.GroupDerivedSchema);
+ connObjectKey.setIntAttrName("displayProperty");
+ mapping.setConnObjectKeyItem(connObjectKey);
+ mapping.setConnObjectLink("'cn=' + displayProperty + ',ou=groups,o=isp'");
+
+ MappingItemTO description = new MappingItemTO();
+ description.setIntMappingType(IntMappingType.GroupKey);
+ description.setExtAttrName("description");
+ description.setPurpose(MappingPurpose.BOTH);
+ mapping.add(description);
+
+ newLDAP = createResource(newLDAP);
+ assertNotNull(newLDAP);
+
+ // 2. create a group and give the resource created above
+ groupTO = getSampleTO("lastGroup" + getUUIDString());
+ groupTO.getPlainAttrs().add(attrTO("icon", "anIcon"));
+ groupTO.getPlainAttrs().add(attrTO("show", "true"));
+ groupTO.getDerAttrs().add(attrTO("displayProperty", null));
+ groupTO.getResources().clear();
+ groupTO.getResources().add("new-ldap");
+
+ groupTO = createGroup(groupTO);
+ assertNotNull(groupTO);
+
+ // 3. update the group
+ GroupPatch groupPatch = new GroupPatch();
+ groupPatch.setKey(groupTO.getKey());
+ groupPatch.getPlainAttrs().add(attrAddReplacePatch("icon", "anotherIcon"));
+
+ groupTO = updateGroup(groupPatch);
+ assertNotNull(groupTO);
+
+ // 4. check that a single group exists in LDAP for the group created and updated above
+ int entries = 0;
+ DirContext ctx = null;
+ try {
+ ctx = getLdapResourceDirContext(null, null);
+
+ SearchControls ctls = new SearchControls();
+ ctls.setReturningAttributes(new String[] { "*", "+" });
+ ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+
+ NamingEnumeration<SearchResult> result =
+ ctx.search("ou=groups,o=isp", "(description=" + groupTO.getKey() + ")", ctls);
+ while (result.hasMore()) {
+ result.next();
+ entries++;
+ }
+ } catch (Exception e) {
+ // ignore
+ } finally {
+ if (ctx != null) {
+ try {
+ ctx.close();
+ } catch (NamingException e) {
+ // ignore
+ }
+ }
+ }
+
+ assertEquals(1, entries);
+ } finally {
+ if (groupTO != null) {
+ groupService.delete(groupTO.getKey());
+ }
+ resourceService.delete("new-ldap");
+ }
+ }
+
++ @Test
++ public void issueSYNCOPE717() {
++ String doubleSchemaName = "double" + getUUIDString();
++
++ // 1. create double schema without conversion pattern
++ PlainSchemaTO schema = new PlainSchemaTO();
++ schema.setKey(doubleSchemaName);
++ schema.setType(AttrSchemaType.Double);
++
++ schema = createSchema(SchemaType.PLAIN, schema);
++ assertNotNull(schema);
++ assertNull(schema.getConversionPattern());
++
++ AnyTypeClassTO minimalGroup = anyTypeClassService.read("minimal group");
++ assertNotNull(minimalGroup);
++ minimalGroup.getPlainSchemas().add(doubleSchemaName);
++ anyTypeClassService.update(minimalGroup);
++
++ // 2. create group, provide valid input value
++ GroupTO groupTO = getBasicSampleTO("syncope717");
++ groupTO.getPlainAttrs().add(attrTO(doubleSchemaName, "11.23"));
++
++ groupTO = createGroup(groupTO);
++ assertNotNull(groupTO);
++ assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
++
++ // 3. update schema, set conversion pattern
++ schema.setConversionPattern("0.000");
++ schemaService.update(SchemaType.PLAIN, schema);
++
++ // 4. re-read group, verify that pattern was applied
++ groupTO = groupService.read(groupTO.getKey());
++ assertNotNull(groupTO);
++ assertEquals("11.230", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
++
++ // 5. modify group with new double value
++ GroupPatch patch = new GroupPatch();
++ patch.setKey(groupTO.getKey());
++ patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.257")).build());
++
++ groupTO = updateGroup(patch);
++ assertNotNull(groupTO);
++ assertEquals("11.257", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
++
++ // 6. update schema, unset conversion pattern
++ schema.setConversionPattern(null);
++ schemaService.update(SchemaType.PLAIN, schema);
++
++ // 7. modify group with new double value, verify that no pattern is applied
++ patch = new GroupPatch();
++ patch.setKey(groupTO.getKey());
++ patch.getPlainAttrs().add(new AttrPatch.Builder().attrTO(attrTO(doubleSchemaName, "11.23")).build());
++
++ groupTO = updateGroup(patch);
++ assertNotNull(groupTO);
++ assertEquals("11.23", groupTO.getPlainAttrMap().get(doubleSchemaName).getValues().get(0));
++ }
++
+}
[12/50] [abbrv] syncope git commit: Fixed SYNCOPE-580,
refactoring and added realm stack, SYNCOPE-158
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
index 1d3e5de..7fca5c0 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
@@ -24,7 +24,7 @@ public class ReportList extends AbstractReportCommand {
public void list() {
try {
- reportResultManager.fromValueToView(reportService.list());
+ reportResultManager.fromValueToView(reportSyncopeOperations.list());
} catch (final SyncopeClientException ex) {
reportResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
index 9bc688e..5b13cbf 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
@@ -26,7 +26,7 @@ public class ReportListJobs extends AbstractReportCommand {
public void list() {
try {
for (final JobStatusType jobStatusType : JobStatusType.values()) {
- reportResultManager.printReportExecution(reportService.listJobs(jobStatusType));
+ reportResultManager.printReportExecution(reportSyncopeOperations.listJobs(jobStatusType));
}
} catch (final SyncopeClientException ex) {
reportResultManager.generic(ex.getMessage());
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
index d1ab975..9a1ebc8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
@@ -40,9 +40,9 @@ public class ReportRead extends AbstractReportCommand {
final List<ReportTO> reportTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- reportTOs.add(reportService.read(Long.valueOf(parameter)));
+ reportTOs.add(reportSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
- reportResultManager.managerNumberFormatException("report", parameter);
+ reportResultManager.numberFormatException("report", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
index 95c61cd..45d1c54 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
@@ -41,7 +41,7 @@ public class ReportReadExecution extends AbstractReportCommand {
final List<ReportExecTO> reportExecTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- reportExecTOs.add(reportService.readExecution(Long.valueOf(parameter)));
+ reportExecTOs.add(reportSyncopeOperations.readExecution(parameter));
} catch (final WebServiceException | SyncopeClientException ex) {
System.out.println("Error:");
if (ex.getMessage().startsWith("NotFound")) {
@@ -50,7 +50,7 @@ public class ReportReadExecution extends AbstractReportCommand {
reportResultManager.generic(ex.getMessage());
}
} catch (final NumberFormatException ex) {
- reportResultManager.managerNumberFormatException("report", parameter);
+ reportResultManager.numberFormatException("report", parameter);
}
}
reportResultManager.printReportExecution(reportExecTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java
new file mode 100644
index 0000000..1cf4514
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportSyncopeOperations.java
@@ -0,0 +1,65 @@
+/*
+ * 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.cli.commands.report;
+
+import java.util.List;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.ReportExecTO;
+import org.apache.syncope.common.lib.to.ReportTO;
+import org.apache.syncope.common.lib.types.JobStatusType;
+import org.apache.syncope.common.lib.types.ReportExecExportFormat;
+import org.apache.syncope.common.rest.api.service.ReportService;
+
+public class ReportSyncopeOperations {
+
+ private final ReportService reportService = SyncopeServices.get(ReportService.class);
+
+ public ReportExecTO readExecution(final String executionid) {
+ return reportService.readExecution(Long.valueOf(executionid));
+ }
+
+ public ReportTO read(final String reportId) {
+ return reportService.read(Long.valueOf(reportId));
+ }
+
+ public List<ReportExecTO> listJobs(final JobStatusType jobStatusType) {
+ return reportService.listJobs(jobStatusType);
+ }
+
+ public List<ReportTO> list() {
+ return reportService.list();
+ }
+
+ public Response exportExecutionResult(final String executionKey, final ReportExecExportFormat fmt) {
+ return reportService.exportExecutionResult(Long.valueOf(executionKey), fmt);
+ }
+
+ public void execute(final String reportId) {
+ reportService.execute(Long.valueOf(reportId));
+ }
+
+ public void deleteExecution(final String executionId) {
+ reportService.deleteExecution(Long.valueOf(executionId));
+ }
+
+ public void delete(final String reportId) {
+ reportService.delete(Long.valueOf(reportId));
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
index 85d4a2d..943f405 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/AbstractResourceCommand.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.client.cli.commands.resource;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.ResourceService;
-
public abstract class AbstractResourceCommand {
- protected final ResourceService resourceService = SyncopeServices.get(ResourceService.class);
-
+ protected final ResourceSyncopeOperations resourceSyncopeOperations = new ResourceSyncopeOperations();
+
protected final ResourceResultManager resourceResultManager = new ResourceResultManager();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
index c3ecd84..9068b7d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
@@ -35,10 +35,10 @@ public class ResourceDelete extends AbstractResourceCommand {
if (input.getParameters().length >= 1) {
for (final String parameter : input.getParameters()) {
try {
- resourceService.delete(parameter);
+ resourceSyncopeOperations.delete(parameter);
resourceResultManager.deletedMessage("resource", parameter);
} catch (final NumberFormatException ex) {
- resourceResultManager.managerNumberFormatException("resource", parameter);
+ resourceResultManager.numberFormatException("resource", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
resourceResultManager.notFoundError("Resource", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
index 85f05f5..27f0d74 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
@@ -24,7 +24,7 @@ public class ResourceList extends AbstractResourceCommand {
public void list() {
try {
- resourceResultManager.toView(resourceService.list());
+ resourceResultManager.toView(resourceSyncopeOperations.list());
} catch (final SyncopeClientException ex) {
resourceResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
index 3790c02..85cd669 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
@@ -39,9 +39,9 @@ public class ResourceRead extends AbstractResourceCommand {
final List<ResourceTO> resourceTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- resourceTOs.add(resourceService.read(parameter));
+ resourceTOs.add(resourceSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
- resourceResultManager.managerNumberFormatException("resource", parameter);
+ resourceResultManager.numberFormatException("resource", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
resourceResultManager.notFoundError("Resource", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
index 91847f4..d598910 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
@@ -54,6 +54,7 @@ public class ResourceResultManager extends CommonsResultManager {
System.out.println(" delete trace level: " + resourceTO.getDeleteTraceLevel());
System.out.println(" update trace level: " + resourceTO.getUpdateTraceLevel());
System.out.println(" sync trace level: " + resourceTO.getSyncTraceLevel());
+ System.out.println("");
}
private void printProvision(final List<ProvisionTO> provisionTOs) {
@@ -66,14 +67,12 @@ public class ResourceResultManager extends CommonsResultManager {
System.out.println(" MAPPING: ");
printMapping(provisionTO.getMapping());
}
- System.out.println("");
}
private void printMapping(final MappingTO mappingTO) {
System.out.println(" ConnObjectLink: " + mappingTO.getConnObjectLink());
System.out.println(" MAPPING ITEM: ");
printMappingItem(mappingTO.getItems());
- System.out.println("");
}
private void printMappingItem(final List<MappingItemTO> mappingItemTOs) {
@@ -88,8 +87,8 @@ public class ResourceResultManager extends CommonsResultManager {
System.out.println(" purpose: " + mappingItemTO.getPurpose());
System.out.println(" connector object key: " + mappingItemTO.isConnObjectKey());
System.out.println(" password: " + mappingItemTO.isPassword());
+ System.out.println("");
}
- System.out.println("");
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java
new file mode 100644
index 0000000..9ddedf8
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceSyncopeOperations.java
@@ -0,0 +1,51 @@
+/*
+ * 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.cli.commands.resource;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.rest.api.service.ResourceService;
+
+public class ResourceSyncopeOperations {
+
+ private final ResourceService resourceService = SyncopeServices.get(ResourceService.class);
+
+ public void delete(final String name) {
+ resourceService.delete(name);
+ }
+
+ public List<ResourceTO> list() {
+ return resourceService.list();
+ }
+
+ public ResourceTO read(final String name) {
+ return resourceService.read(name);
+ }
+
+ public boolean exists(final String name) {
+ try {
+ read(name);
+ return true;
+ } catch (final SyncopeClientException ex) {
+ return false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
index 3074135..96dae04 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/AbstractSchemaCommand.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.client.cli.commands.schema;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.SchemaService;
-
public abstract class AbstractSchemaCommand {
- protected final SchemaService schemaService = SyncopeServices.get(SchemaService.class);
-
+ protected final SchemaSyncopeOperations schemaSyncopeOperations = new SchemaSyncopeOperations();
+
protected final SchemaResultManager schemaResultManager = new SchemaResultManager();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
index 9cf6fe2..0850e2f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
@@ -41,7 +41,7 @@ public class SchemaDelete extends AbstractSchemaCommand {
final String[] parameters = Arrays.copyOfRange(input.getParameters(), 1, input.parameterNumber());
try {
for (final String parameter : parameters) {
- schemaService.delete(SchemaType.valueOf(input.firstParameter()), parameter);
+ schemaSyncopeOperations.delete(SchemaType.valueOf(input.firstParameter()), parameter);
schemaResultManager.deletedMessage("Schema", parameter);
}
} catch (final SyncopeClientException | WebServiceException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
index 5f51604..404a487 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
@@ -41,7 +41,7 @@ public class SchemaList extends AbstractSchemaCommand {
try {
final SchemaType schemaType = SchemaType.valueOf(input.firstParameter());
final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaService.list(schemaType)) {
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.list(schemaType)) {
schemaTOs.add(schemaTO);
}
switch (schemaType) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
index 5d00adb..57d95a1 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
@@ -30,7 +30,7 @@ public class SchemaListAll extends AbstractSchemaCommand {
try {
for (final SchemaType schemaType : SchemaType.values()) {
final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaService.list(schemaType)) {
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.list(schemaType)) {
schemaTOs.add(schemaTO);
}
switch (schemaType) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
index 8cdb501..ee90327 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
@@ -22,14 +22,13 @@ import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
public class SchemaListDerived extends AbstractSchemaCommand {
public void listDerived() {
try {
final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.DERIVED)) {
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listDerived()) {
schemaTOs.add(schemaTO);
}
schemaResultManager.fromListDerived(schemaTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
index e4160a7..6fa9ad6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
@@ -22,14 +22,13 @@ import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
public class SchemaListPlain extends AbstractSchemaCommand {
public void listPlain() {
try {
final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.PLAIN)) {
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listPlain()) {
schemaTOs.add(schemaTO);
}
schemaResultManager.fromListPlain(schemaTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
index 7b1bf24..74b5b6c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
@@ -22,14 +22,13 @@ import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
public class SchemaListVirtual extends AbstractSchemaCommand {
public void listVirtual() {
try {
final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.VIRTUAL)) {
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listVirtual()) {
schemaTOs.add(schemaTO);
}
schemaResultManager.fromListVirtual(schemaTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
index 97f1029..d84444d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
@@ -45,7 +45,7 @@ public class SchemaRead extends AbstractSchemaCommand {
final SchemaType schemaType = SchemaType.valueOf(input.firstParameter());
final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
for (final String parameter : parameters) {
- schemaTOs.add(schemaService.read(schemaType, parameter));
+ schemaTOs.add(schemaSyncopeOperations.read(schemaType, parameter));
}
switch (schemaType) {
case PLAIN:
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
new file mode 100644
index 0000000..c8f0a6d
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.cli.commands.schema;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.service.SchemaService;
+
+public class SchemaSyncopeOperations {
+
+ private final SchemaService schemaService = SyncopeServices.get(SchemaService.class);
+
+ public <T extends AbstractSchemaTO> T read(final SchemaType schemaType, final String schemaName) {
+ return schemaService.read(schemaType, schemaName);
+ }
+
+ public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType) {
+ return schemaService.list(schemaType);
+ }
+
+ public <T extends AbstractSchemaTO> List<T> listVirtual() {
+ return schemaService.list(SchemaType.VIRTUAL);
+ }
+
+ public <T extends AbstractSchemaTO> List<T> listPlain() {
+ return schemaService.list(SchemaType.PLAIN);
+ }
+
+ public <T extends AbstractSchemaTO> List<T> listDerived() {
+ return schemaService.list(SchemaType.DERIVED);
+ }
+
+ public void delete(final SchemaType schemaType, final String schemaName) {
+ schemaService.delete(schemaType, schemaName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
index 18e877a..bdc4c22 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/AbstractTaskCommand.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.task;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.rest.api.service.TaskService;
-
public abstract class AbstractTaskCommand {
- protected final TaskService taskService = SyncopeServices.get(TaskService.class);
+ protected final TaskSyncopeOperations taskSyncopeOperations = new TaskSyncopeOperations();
protected final TaskResultManager taskResultManager = new TaskResultManager();
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
index 655e112..e0d4753 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
@@ -37,7 +37,7 @@ public class TaskDelete extends AbstractTaskCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- taskService.delete(Long.valueOf(parameter));
+ taskSyncopeOperations.delete(parameter);
taskResultManager.deletedMessage("Task", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
index 9f53ece..dfefae3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
@@ -37,7 +37,6 @@ public class TaskExecute extends AbstractTaskCommand {
public void execute() {
if (input.parameterNumber() == 2) {
try {
- final Long taskIdToExecute = Long.valueOf(input.firstParameter());
boolean dryRun = true;
if ("false".equalsIgnoreCase(input.secondParameter())) {
dryRun = false;
@@ -46,7 +45,8 @@ public class TaskExecute extends AbstractTaskCommand {
} else {
taskResultManager.notBooleanDeletedError("dry run", input.secondParameter());
}
- taskResultManager.printTaskExecTO(Arrays.asList(taskService.execute(taskIdToExecute, dryRun)));
+ taskResultManager.printTaskExecTO(Arrays.asList(
+ taskSyncopeOperations.execute(input.firstParameter(), dryRun)));
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
taskResultManager.notFoundError("Task", input.firstParameter());
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
index a107716..bb6d694 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
@@ -37,7 +37,7 @@ public class TaskExecutionDelete extends AbstractTaskCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- taskService.deleteExecution(Long.valueOf(parameter));
+ taskSyncopeOperations.deleteExecution(parameter);
taskResultManager.deletedMessage("Task execution", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
index d24641d..d83e2ef 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
@@ -38,7 +38,7 @@ public class TaskExecutionRead extends AbstractTaskCommand {
for (final String parameter : input.getParameters()) {
try {
taskResultManager.printTaskExecTO(
- Arrays.asList(taskService.readExecution(Long.valueOf(parameter))));
+ Arrays.asList(taskSyncopeOperations.readExecution(parameter)));
} catch (final NumberFormatException ex) {
taskResultManager.notBooleanDeletedError("task execution", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
index 203dbcb..b8c08e5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
@@ -42,7 +42,7 @@ public class TaskList extends AbstractTaskCommand {
try {
final TaskType taskType = TaskType.valueOf(input.firstParameter());
final LinkedList<AbstractTaskTO> taskTOs = new LinkedList<>();
- for (final AbstractTaskTO taskTO : taskService.list(taskType, new TaskQuery()).getResult()) {
+ for (final AbstractTaskTO taskTO : taskSyncopeOperations.list(taskType, new TaskQuery()).getResult()) {
taskTOs.add(taskTO);
}
taskResultManager.fromList(taskType, taskTOs);
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
index 2538254..9e93d9e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRead.java
@@ -39,7 +39,7 @@ public class TaskRead extends AbstractTaskCommand {
final LinkedList<AbstractTaskTO> taskTOs = new LinkedList<>();
for (final String parameter : input.getParameters()) {
try {
- taskTOs.add(taskService.read(Long.valueOf(parameter)));
+ taskTOs.add(taskSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
taskResultManager.notBooleanDeletedError("task", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
index fdb886f..d3a7e93 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskRunningJobs.java
@@ -19,13 +19,12 @@
package org.apache.syncope.client.cli.commands.task;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.JobStatusType;
public class TaskRunningJobs extends AbstractTaskCommand {
public void list() {
try {
- taskResultManager.printTaskExecTO(taskService.listJobs(JobStatusType.RUNNING));
+ taskResultManager.printTaskExecTO(taskSyncopeOperations.listRunningJobs());
} catch (final SyncopeClientException ex) {
taskResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
index d95f122..c4798d5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskScheduledJobs.java
@@ -19,13 +19,12 @@
package org.apache.syncope.client.cli.commands.task;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.JobStatusType;
public class TaskScheduledJobs extends AbstractTaskCommand {
public void list() {
try {
- taskResultManager.printTaskExecTO(taskService.listJobs(JobStatusType.SCHEDULED));
+ taskResultManager.printTaskExecTO(taskSyncopeOperations.listScheduledJobs());
} catch (final SyncopeClientException ex) {
taskResultManager.generic(ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
new file mode 100644
index 0000000..6b819e9
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskSyncopeOperations.java
@@ -0,0 +1,66 @@
+/*
+ * 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.cli.commands.task;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.TaskExecTO;
+import org.apache.syncope.common.lib.types.JobStatusType;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.common.rest.api.beans.TaskQuery;
+import org.apache.syncope.common.rest.api.service.TaskService;
+
+public class TaskSyncopeOperations {
+
+ private final TaskService taskService = SyncopeServices.get(TaskService.class);
+
+ public List<TaskExecTO> listScheduledJobs() {
+ return taskService.listJobs(JobStatusType.SCHEDULED);
+ }
+
+ public List<TaskExecTO> listRunningJobs() {
+ return taskService.listJobs(JobStatusType.RUNNING);
+ }
+
+ public <T extends AbstractTaskTO> T read(final String taskId) {
+ return taskService.read(Long.valueOf(taskId));
+ }
+
+ public void delete(final String taskId) {
+ taskService.read(Long.valueOf(taskId));
+ }
+
+ public <T extends AbstractTaskTO> PagedResult<T> list(final TaskType type, final TaskQuery query) {
+ return taskService.list(type, query);
+ }
+
+ public TaskExecTO readExecution(final String executionId) {
+ return taskService.readExecution(Long.valueOf(executionId));
+ }
+
+ public void deleteExecution(final String executionId) {
+ taskService.deleteExecution(Long.valueOf(executionId));
+ }
+
+ public TaskExecTO execute(final String executionId, final boolean dryRun) {
+ return taskService.execute(Long.valueOf(executionId), dryRun);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java
new file mode 100644
index 0000000..5a28a04
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/AbstractUserCommand.java
@@ -0,0 +1,27 @@
+/*
+ * 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.cli.commands.user;
+
+public abstract class AbstractUserCommand {
+
+ protected final UserSyncopeOperations userSyncopeOperations = new UserSyncopeOperations();
+
+ protected final UserResultManager userResultManager = new UserResultManager();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
new file mode 100644
index 0000000..35c3941
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCommand.java
@@ -0,0 +1,144 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "user")
+public class UserCommand extends AbstractCommand {
+
+ private static final String HELP_MESSAGE = "Usage: user [options]\n"
+ + " Options:\n"
+ + " --help \n"
+ + " --list \n"
+ + " --count \n"
+ + " --get-user-key\n"
+ + " Syntax: --get-user-key {USER-ID} {USER-ID} [...]\n"
+ + " --get-username\n"
+ + " Syntax: --get-username {USERNAME} {USERNAME} [...]\n"
+ + " --read \n"
+ + " Syntax: --read {USER-ID} {USER-ID} [...]\n"
+ + " --search-by-attribute \n"
+ + " Syntax: --search-by-attribute {REALM} {ATTR-NAME}={ATTR-VALUE}\n"
+ + " --search-by-role \n"
+ + " Syntax: --search-by-role {REALM} {ROLE-ID}\n"
+ + " --search-by-resource \n"
+ + " Syntax: --search-by-resource {REALM} {RESOURCE-NAME}\n"
+ + " --delete \n"
+ + " Syntax: --delete {USER-ID} {USER-ID} [...]";
+
+ @Override
+ public void execute(final Input input) {
+ if (StringUtils.isBlank(input.getOption())) {
+ input.setOption(UserOptions.HELP.getOptionName());
+ }
+
+ switch (UserOptions.fromName(input.getOption())) {
+ case COUNT:
+ new UserCount(input).count();
+ break;
+ case LIST:
+ new UserList().list();
+ break;
+ case GET_BY_KEY:
+ new UserGetKey(input).get();
+ break;
+ case GET_BY_USERNAME:
+ new UserGetUsername(input).get();
+ break;
+ case READ:
+ new UserRead(input).read();
+ break;
+ case SEARCH_BY_ATTRIBUTE:
+ new UserSearchByAttribute(input).search();
+ break;
+ case SEARCH_BY_ROLE:
+ new UserSearchByRole(input).search();
+ break;
+ case SEARCH_BY_RESOURCE:
+ new UserSearchByResource(input).search();
+ break;
+ case DELETE:
+ new UserDelete(input).delete();
+ break;
+ case HELP:
+ System.out.println(HELP_MESSAGE);
+ break;
+ default:
+ new UserResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+ }
+ }
+
+ @Override
+ public String getHelpMessage() {
+ return HELP_MESSAGE;
+ }
+
+ private enum UserOptions {
+
+ HELP("--help"),
+ COUNT("--count"),
+ LIST("--list"),
+ GET_BY_KEY("--get-user-key"),
+ GET_BY_USERNAME("--get-username"),
+ READ("--read"),
+ SEARCH_BY_ATTRIBUTE("--search-by-attribute"),
+ SEARCH_BY_ROLE("--search-by-role"),
+ SEARCH_BY_RESOURCE("--search-by-resource"),
+ DELETE("--delete");
+
+ private final String optionName;
+
+ UserOptions(final String optionName) {
+ this.optionName = optionName;
+ }
+
+ public String getOptionName() {
+ return optionName;
+ }
+
+ public boolean equalsOptionName(final String otherName) {
+ return (otherName == null) ? false : optionName.equals(otherName);
+ }
+
+ public static UserOptions fromName(final String name) {
+ UserOptions optionToReturn = HELP;
+ for (final UserOptions option : UserOptions.values()) {
+ if (option.equalsOptionName(name)) {
+ optionToReturn = option;
+ }
+ }
+ return optionToReturn;
+ }
+
+ public static List<String> toList() {
+ final List<String> options = new ArrayList<>();
+ for (final UserOptions value : values()) {
+ options.add(value.getOptionName());
+ }
+ return options;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
new file mode 100644
index 0000000..a9cff9e
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserCount.java
@@ -0,0 +1,43 @@
+/*
+ * 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.cli.commands.user;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserCount extends AbstractUserCommand {
+
+ private final Input input;
+
+ public UserCount(final Input input) {
+ this.input = input;
+ }
+
+ public void count() {
+ if (input.parameterNumber() == 0) {
+ try {
+ userResultManager.generic("Total users: " + userSyncopeOperations.count());
+ } catch (final SyncopeClientException ex) {
+ userResultManager.generic("Error: " + ex.getMessage());
+ }
+ } else {
+ userResultManager.generic("Error: unnecessary parameters " + input.listParameters());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
new file mode 100644
index 0000000..817db6c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserDelete.java
@@ -0,0 +1,55 @@
+/*
+ * 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.cli.commands.user;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserDelete extends AbstractUserCommand {
+
+ private static final String DELETE_HELP_MESSAGE = "user --delete {USER-ID} {USER-ID} [...]";
+
+ private final Input input;
+
+ public UserDelete(final Input input) {
+ this.input = input;
+ }
+
+ public void delete() {
+ if (input.parameterNumber() >= 1) {
+ for (final String parameter : input.getParameters()) {
+ try {
+ userSyncopeOperations.delete(parameter);
+ userResultManager.deletedMessage("User", parameter);
+ } catch (final WebServiceException | SyncopeClientException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ userResultManager.notFoundError("User", parameter);
+ } else {
+ userResultManager.generic(ex.getMessage());
+ }
+ } catch (final NumberFormatException ex) {
+ userResultManager.numberFormatException("user", parameter);
+ }
+ }
+ } else {
+ userResultManager.commandOptionError(DELETE_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
new file mode 100644
index 0000000..d64a327
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetKey.java
@@ -0,0 +1,45 @@
+/*
+ * 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.cli.commands.user;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserGetKey extends AbstractUserCommand {
+
+ private static final String GET_HELP_MESSAGE = "user --get-user-key {USERNAME}";
+
+ private final Input input;
+
+ public UserGetKey(final Input input) {
+ this.input = input;
+ }
+
+ public void get() {
+ if (input.getParameters().length == 1) {
+ try {
+ userResultManager.generic(userSyncopeOperations.getIdFromUsername(input.firstParameter()));
+ } catch (final SyncopeClientException ex) {
+ userResultManager.generic("Error: " + ex.getMessage());
+ }
+ } else {
+ userResultManager.commandOptionError(GET_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
new file mode 100644
index 0000000..a94b1df
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserGetUsername.java
@@ -0,0 +1,45 @@
+/*
+ * 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.cli.commands.user;
+
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class UserGetUsername extends AbstractUserCommand {
+
+ private static final String GET_HELP_MESSAGE = "user --get-username {USER-ID}";
+
+ private final Input input;
+
+ public UserGetUsername(final Input input) {
+ this.input = input;
+ }
+
+ public void get() {
+ if (input.getParameters().length == 1) {
+ try {
+ userResultManager.generic(userSyncopeOperations.getUsernameFromId(input.firstParameter()));
+ } catch (final SyncopeClientException ex) {
+ userResultManager.generic("Error: " + ex.getMessage());
+ }
+ } else {
+ userResultManager.commandOptionError(GET_HELP_MESSAGE);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
new file mode 100644
index 0000000..4778cd2
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserList.java
@@ -0,0 +1,48 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.LinkedList;
+import java.util.Scanner;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserList extends AbstractUserCommand {
+
+ public void list() {
+ try {
+ final Scanner scanIn = new Scanner(System.in);
+ System.out.println(
+ "This operation could be print a lot of information "
+ + "on your screen. Do you want to continue? [yes/no]");
+ final String answer = scanIn.nextLine();
+ if ("yes".equalsIgnoreCase(answer)) {
+ final PagedResult<UserTO> uResult = userSyncopeOperations.list();
+ userResultManager.toView(new LinkedList<>(uResult.getResult()));
+ } else if ("no".equalsIgnoreCase(answer)) {
+ userResultManager.generic("List operation skipped");
+ } else {
+ userResultManager.generic("Invalid parameter, please use [yes/no]");
+ }
+ } catch (final SyncopeClientException ex) {
+ userResultManager.generic(ex.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
new file mode 100644
index 0000000..ae94409
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserRead.java
@@ -0,0 +1,60 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.LinkedList;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserRead extends AbstractUserCommand {
+
+ private static final String READ_HELP_MESSAGE = "user --read {USER-ID} {USER-ID} [...]";
+
+ private final Input input;
+
+ public UserRead(final Input input) {
+ this.input = input;
+ }
+
+ public void read() {
+ if (input.getParameters().length >= 1) {
+ final LinkedList<UserTO> userTOs = new LinkedList<>();
+ for (final String parameter : input.getParameters()) {
+ try {
+ userTOs.add(userSyncopeOperations.read(parameter));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ userResultManager.notFoundError("Logger", parameter);
+ } else {
+ userResultManager.generic("Error: " + ex.getMessage());
+ }
+ break;
+ } catch (final NumberFormatException ex) {
+ userResultManager.numberFormatException("user", parameter);
+ }
+ }
+ userResultManager.toView(userTOs);
+ } else {
+ userResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
new file mode 100644
index 0000000..2ea0578
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserResultManager.java
@@ -0,0 +1,110 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.RelationshipTO;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserResultManager extends CommonsResultManager {
+
+ public void toView(final List<UserTO> userTOs) {
+ for (final UserTO userTO : userTOs) {
+ printUser(userTO);
+ }
+ System.out.println("");
+ }
+
+ private void printUser(final UserTO userTO) {
+ System.out.println(" > USER ID: " + userTO.getKey());
+ System.out.println(" username: " + userTO.getUsername());
+ System.out.println(" realm: " + userTO.getRealm());
+ System.out.println(" status: " + userTO.getStatus());
+ System.out.println(" RESOURCES: ");
+ printResource(userTO.getResources());
+ System.out.println(" ROLES: ");
+ printRole(userTO.getRoles());
+ System.out.println(" creation date: " + userTO.getCreationDate());
+ System.out.println(" change password date: " + userTO.getChangePwdDate());
+ System.out.println(" PLAIN ATTRIBUTES: ");
+ printAttributes(userTO.getPlainAttrs());
+ System.out.println(" DERIVED ATTRIBUTES: ");
+ printAttributes(userTO.getDerAttrs());
+ System.out.println(" VIRTUAL ATTRIBUTES: ");
+ printAttributes(userTO.getVirAttrs());
+ System.out.println(" creator: " + userTO.getCreator());
+ System.out.println(" last modifier: " + userTO.getLastModifier());
+ System.out.println(" token: " + userTO.getToken());
+ System.out.println(" token expiration time: " + userTO.getTokenExpireTime());
+ System.out.println(" last change: " + userTO.getLastChangeDate());
+ System.out.println(" last login: " + userTO.getLastLoginDate());
+ System.out.println(" failed logins: " + userTO.getFailedLogins());
+ System.out.println("PROPAGATIONS:");
+ printPropagationStatus(userTO.getPropagationStatusTOs());
+ System.out.println("RELATIONSHIPS:");
+ printRelationships(userTO.getRelationships());
+ System.out.println(" security question id: " + userTO.getSecurityQuestion());
+ System.out.println(" security question answer id: " + userTO.getSecurityAnswer());
+ System.out.println("");
+ }
+
+ private void printResource(final Set<String> resources) {
+ for (final String resource : resources) {
+ System.out.println(" - " + resource);
+ }
+ }
+
+ private void printRole(final List<Long> roles) {
+ for (final Long role : roles) {
+ System.out.println(" - " + role);
+ }
+ }
+
+ private void printAttributes(final Set<AttrTO> derAttrTOs) {
+ for (final AttrTO attrTO : derAttrTOs) {
+ final StringBuilder attributeSentence = new StringBuilder();
+ attributeSentence.append(" ")
+ .append(attrTO.getSchema())
+ .append(": ")
+ .append(attrTO.getValues());
+ if (attrTO.isReadonly()) {
+ attributeSentence.append(" - is readonly.");
+ }
+ System.out.println(attributeSentence);
+ }
+ }
+
+ private void printPropagationStatus(final List<PropagationStatus> propagationStatuses) {
+ for (final PropagationStatus propagationStatus : propagationStatuses) {
+ System.out.println(" status: " + propagationStatus.getStatus());
+ System.out.println(" resource: " + propagationStatus.getResource());
+ System.out.println(" failure reason: " + propagationStatus.getFailureReason());
+ }
+ }
+
+ private void printRelationships(final List<RelationshipTO> relationshipTOs) {
+ for (final RelationshipTO relationshipTO : relationshipTOs) {
+ System.out.println(" type: " + relationshipTO.getType());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
new file mode 100644
index 0000000..18ac77e
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByAttribute.java
@@ -0,0 +1,69 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.realm.RealmSyncopeOperations;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserSearchByAttribute extends AbstractUserCommand {
+
+ private static final String SEARCH_HELP_MESSAGE = "user --search-by-attribute {REALM} {ATTR-NAME}={ATTR-VALUE}";
+
+ private final Input input;
+
+ public UserSearchByAttribute(final Input input) {
+ this.input = input;
+ }
+
+ public void search() {
+ if (input.parameterNumber() >= 2) {
+ final String realm = input.firstParameter();
+ final Input.PairParameter pairParameter = input.toPairParameter(input.secondParameter());
+ final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+ try {
+ List<UserTO> userTOs;
+ if (!realmSyncopeOperations.exists(realm)) {
+ userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+ }
+ userTOs = userSyncopeOperations.searchByAttribute(
+ realm, pairParameter.getKey(), pairParameter.getValue());
+ if (userTOs == null || userTOs.isEmpty()) {
+ userResultManager.generic("No users found with attribute "
+ + pairParameter.getKey() + " and value " + pairParameter.getValue());
+ } else {
+ userResultManager.toView(userTOs);
+ }
+ } catch (final WebServiceException | SyncopeClientException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ userResultManager.notFoundError("User with " + pairParameter.getKey(), pairParameter.getValue());
+ } else {
+ userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ }
+ } catch (final IllegalArgumentException ex) {
+ userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ }
+ userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
new file mode 100644
index 0000000..6a22150
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByResource.java
@@ -0,0 +1,68 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.realm.RealmSyncopeOperations;
+import org.apache.syncope.client.cli.commands.resource.ResourceSyncopeOperations;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserSearchByResource extends AbstractUserCommand {
+
+ private static final String SEARCH_HELP_MESSAGE = "user --search {REALM} {RESOURCE-NAME}";
+
+ private final Input input;
+
+ public UserSearchByResource(final Input input) {
+ this.input = input;
+ }
+
+ public void search() {
+ if (input.parameterNumber() == 2) {
+ final String realm = input.firstParameter();
+ final String resource = input.secondParameter();
+ final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+ final ResourceSyncopeOperations resourceSyncopeOperations = new ResourceSyncopeOperations();
+ try {
+ List<UserTO> userTOs = null;
+ if (!realmSyncopeOperations.exists(realm)) {
+ userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+ }
+ if (!resourceSyncopeOperations.exists(resource)) {
+ userResultManager.notFoundError("Resource", resource);
+ } else {
+ userTOs = userSyncopeOperations.searchByResource(realm, resource);
+ }
+ if (userTOs == null || userTOs.isEmpty()) {
+ userResultManager.generic("No users has " + resource + " assigned");
+ } else {
+ userResultManager.toView(userTOs);
+ }
+ } catch (final WebServiceException | SyncopeClientException ex) {
+ userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ }
+ } else {
+ userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
new file mode 100644
index 0000000..789bacb
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSearchByRole.java
@@ -0,0 +1,62 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.realm.RealmSyncopeOperations;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class UserSearchByRole extends AbstractUserCommand {
+
+ private static final String SEARCH_HELP_MESSAGE = "user --search {REALM} {ROLE-ID}";
+
+ private final Input input;
+
+ public UserSearchByRole(final Input input) {
+ this.input = input;
+ }
+
+ public void search() {
+ if (input.parameterNumber() == 2) {
+ final String realm = input.firstParameter();
+ final String role = input.secondParameter();
+ final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
+ try {
+ List<UserTO> userTOs;
+ if (!realmSyncopeOperations.exists(realm)) {
+ userResultManager.generic("Operation performed on root realm because " + realm + "does not exists");
+ }
+ userTOs = userSyncopeOperations.searchByRole(realm, input.secondParameter());
+ if (userTOs == null || userTOs.isEmpty()) {
+ userResultManager.generic("No users has " + role + " assigned");
+ } else {
+ userResultManager.toView(userTOs);
+ }
+ } catch (final WebServiceException | SyncopeClientException ex) {
+ userResultManager.generic(ex.getMessage(), SEARCH_HELP_MESSAGE);
+ }
+ } else {
+ userResultManager.commandOptionError(SEARCH_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/47b9f64b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
new file mode 100644
index 0000000..0496d97
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/user/UserSyncopeOperations.java
@@ -0,0 +1,78 @@
+/*
+ * 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.cli.commands.user;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.beans.AnyListQuery;
+import org.apache.syncope.common.rest.api.service.UserService;
+
+public class UserSyncopeOperations {
+
+ private final UserService userService = SyncopeServices.get(UserService.class);
+
+ public List<UserTO> searchByRole(final String realm, final String role) {
+ return userService.search(
+ SyncopeClient.getAnySearchQueryBuilder().realm(realm).
+ fiql(SyncopeClient.getUserSearchConditionBuilder().inRoles(Long.valueOf(role))
+ .query()).build()).getResult();
+ }
+
+ public List<UserTO> searchByResource(final String realm, final String resource) {
+ return userService.search(
+ SyncopeClient.getAnySearchQueryBuilder().realm(realm).
+ fiql(SyncopeClient.getUserSearchConditionBuilder().hasResources(resource)
+ .query()).build()).getResult();
+ }
+
+ public List<UserTO> searchByAttribute(final String realm, final String attributeName, final String attributeValue) {
+ return userService.search(
+ SyncopeClient.getAnySearchQueryBuilder().realm(realm).
+ fiql(SyncopeClient.getUserSearchConditionBuilder().is(attributeName).equalTo(attributeValue)
+ .query()).build()).getResult();
+ }
+
+ public PagedResult<UserTO> list() {
+ return userService.list(new AnyListQuery());
+ }
+
+ public UserTO read(final String userId) {
+ return userService.read(Long.valueOf(userId));
+ }
+
+ public void delete(final String userId) {
+ userService.delete(Long.valueOf(userId));
+ }
+
+ public int count() {
+ return list().getResult().size();
+ }
+
+ public String getUsernameFromId(final String userId) {
+ return userService.getUsername(Long.valueOf(userId)).getHeaderString(RESTHeaders.USERNAME);
+ }
+
+ public String getIdFromUsername(final String username) {
+ return userService.getUserKey(username).getHeaderString(RESTHeaders.USER_KEY);
+ }
+}
[27/50] [abbrv] syncope git commit: message refactoring, SYNCOPE-158
Posted by fm...@apache.org.
message refactoring, SYNCOPE-158
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/6d368c8b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/6d368c8b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/6d368c8b
Branch: refs/heads/SYNCOPE-156
Commit: 6d368c8b264e11e35d709365e39e663ede7bc57e
Parents: e486aaf
Author: massi <ma...@tirasa.net>
Authored: Thu Oct 29 13:27:57 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Thu Oct 29 13:27:57 2015 +0100
----------------------------------------------------------------------
.../apache/syncope/client/cli/SyncopeAdm.java | 7 +-
.../cli/commands/CommonsResultManager.java | 13 +-
.../configuration/ConfigurationCommand.java | 2 +-
.../configuration/ConfigurationDelete.java | 5 +-
.../configuration/ConfigurationExport.java | 12 +-
.../configuration/ConfigurationGet.java | 21 ++-
.../configuration/ConfigurationRead.java | 3 +-
.../configuration/ConfigurationUpdate.java | 7 +-
.../commands/connector/ConnectorCommand.java | 4 +-
.../cli/commands/connector/ConnectorDelete.java | 5 +-
.../cli/commands/connector/ConnectorList.java | 21 ++-
.../connector/ConnectorListBundles.java | 21 ++-
.../ConnectorListConfigurationProperties.java | 8 +-
.../cli/commands/connector/ConnectorRead.java | 11 +-
.../connector/ConnectorReadByResource.java | 11 +-
.../connector/ConnectorResultManager.java | 39 +++---
.../connector/ConnectorSyncopeOperations.java | 2 +-
.../cli/commands/domain/DomainCommand.java | 4 +-
.../cli/commands/domain/DomainDelete.java | 5 +-
.../client/cli/commands/domain/DomainList.java | 22 ++-
.../client/cli/commands/domain/DomainRead.java | 6 +-
.../commands/domain/DomainResultManager.java | 12 ++
.../entitlement/AbstractEntitlementCommand.java | 2 +-
.../entitlement/EntitlementCommand.java | 5 +-
.../commands/entitlement/EntitlementList.java | 16 ++-
.../entitlement/EntitlementListRole.java | 5 +-
.../entitlement/EntitlementReadByUserId.java | 2 +-
.../entitlement/EntitlementReadByUsername.java | 2 +-
.../entitlement/EntitlementResultManager.java | 1 -
.../entitlement/EntitlementSearchByRole.java | 3 +-
.../syncope/client/cli/commands/help/Help.java | 6 +-
.../cli/commands/help/HelpResultManager.java | 3 +
.../syncope/client/cli/commands/info/Info.java | 133 +++++++------------
.../cli/commands/info/InfoResultManager.java | 126 ++++++++++++++++++
.../cli/commands/install/InstallCommand.java | 13 +-
.../commands/install/InstallResultManager.java | 10 ++
.../cli/commands/install/InstallSetup.java | 20 +--
.../cli/commands/logger/LoggerCommand.java | 3 +-
.../cli/commands/logger/LoggerCreate.java | 1 -
.../cli/commands/logger/LoggerDelete.java | 3 +-
.../client/cli/commands/logger/LoggerList.java | 20 ++-
.../client/cli/commands/logger/LoggerRead.java | 2 +-
.../commands/logger/LoggerResultManager.java | 1 -
.../cli/commands/logger/LoggerUpdate.java | 6 +-
.../cli/commands/logger/LoggerUpdateAll.java | 3 +-
.../notification/NotificationCommand.java | 3 +-
.../notification/NotificationDelete.java | 3 +-
.../commands/notification/NotificationList.java | 23 +++-
.../commands/notification/NotificationRead.java | 2 +-
.../cli/commands/policy/PolicyCommand.java | 1 -
.../cli/commands/policy/PolicyDelete.java | 6 +-
.../client/cli/commands/policy/PolicyList.java | 2 +-
.../client/cli/commands/policy/PolicyRead.java | 4 +-
.../cli/commands/question/QuestionCommand.java | 3 +-
.../cli/commands/question/QuestionDelete.java | 3 +-
.../cli/commands/question/QuestionList.java | 21 ++-
.../cli/commands/question/QuestionRead.java | 3 +-
.../question/QuestionSyncopeOperations.java | 1 -
.../client/cli/commands/realm/RealmCommand.java | 3 +-
.../client/cli/commands/realm/RealmList.java | 21 ++-
.../commands/realm/RealmSyncopeOperations.java | 1 -
.../cli/commands/report/ReportCommand.java | 5 +-
.../cli/commands/report/ReportDelete.java | 5 +-
.../commands/report/ReportDeleteExecution.java | 7 +-
.../cli/commands/report/ReportExecute.java | 6 +-
.../commands/report/ReportExportExecution.java | 18 +--
.../client/cli/commands/report/ReportList.java | 22 ++-
.../cli/commands/report/ReportListJobs.java | 23 +++-
.../client/cli/commands/report/ReportRead.java | 2 +-
.../commands/report/ReportReadExecution.java | 4 +-
.../cli/commands/resource/ResourceCommand.java | 3 +-
.../cli/commands/resource/ResourceDelete.java | 3 +-
.../cli/commands/resource/ResourceList.java | 21 ++-
.../cli/commands/resource/ResourceRead.java | 3 +-
.../resource/ResourceResultManager.java | 2 -
.../client/cli/commands/role/RoleCommand.java | 3 +-
.../client/cli/commands/role/RoleDelete.java | 2 +-
.../client/cli/commands/role/RoleList.java | 21 ++-
.../client/cli/commands/role/RoleRead.java | 3 +-
.../commands/role/RoleSyncopeOperations.java | 1 -
.../cli/commands/schema/SchemaCommand.java | 8 +-
.../cli/commands/schema/SchemaDelete.java | 5 +-
.../client/cli/commands/schema/SchemaList.java | 2 +-
.../cli/commands/schema/SchemaListAll.java | 54 +++++---
.../cli/commands/schema/SchemaListDerived.java | 27 +++-
.../cli/commands/schema/SchemaListPlain.java | 27 +++-
.../cli/commands/schema/SchemaListVirtual.java | 27 +++-
.../client/cli/commands/schema/SchemaRead.java | 3 +-
.../cli/commands/self/WorkflowCommand.java | 1 -
.../commands/self/WorkflowExportDefinition.java | 2 +-
.../commands/self/WorkflowExportDiagram.java | 6 +-
.../self/WorkflowSyncopeOperations.java | 1 -
.../client/cli/commands/task/TaskCommand.java | 5 +-
.../client/cli/commands/task/TaskDelete.java | 4 +-
.../client/cli/commands/task/TaskExecute.java | 5 +-
.../cli/commands/task/TaskExecutionDelete.java | 4 +-
.../cli/commands/task/TaskExecutionRead.java | 3 +-
.../client/cli/commands/task/TaskList.java | 2 +-
.../cli/commands/task/TaskListRunningJobs.java | 46 +++++++
.../commands/task/TaskListScheduledJobs.java | 45 +++++++
.../client/cli/commands/task/TaskRead.java | 3 +-
.../cli/commands/task/TaskRunningJobs.java | 33 -----
.../cli/commands/task/TaskScheduledJobs.java | 33 -----
.../client/cli/commands/user/UserCommand.java | 3 +-
.../client/cli/commands/user/UserCount.java | 8 +-
.../client/cli/commands/user/UserDelete.java | 2 +-
.../client/cli/commands/user/UserGetKey.java | 4 +-
.../cli/commands/user/UserGetUsername.java | 4 +-
.../client/cli/commands/user/UserList.java | 43 +++---
.../client/cli/commands/user/UserRead.java | 3 +-
.../cli/commands/user/UserResultManager.java | 1 -
.../commands/user/UserSearchByAttribute.java | 11 +-
.../cli/commands/user/UserSearchByResource.java | 9 +-
.../cli/commands/user/UserSearchByRole.java | 9 +-
.../syncope/client/cli/util/CommandUtils.java | 1 -
.../client/cli/util/FileSystemUtils.java | 9 +-
.../syncope/client/cli/util/JasyptUtils.java | 1 -
.../syncope/client/cli/view/Messages.java | 7 +-
118 files changed, 835 insertions(+), 507 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
index 7308c57..8b6150a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
@@ -50,12 +50,13 @@ public final class SyncopeAdm {
System.out.println(helpMessage());
} catch (final IllegalArgumentException ex) {
LOG.error("Error in main", ex);
- RESULT_MANAGER.generic(ex.getMessage());
+ RESULT_MANAGER.genericError(ex.getMessage());
if (!ex.getMessage().startsWith("It seems you")) {
System.out.println(helpMessage());
}
} catch (final ProcessingException e) {
- RESULT_MANAGER.generic("Syncope server offline", e.getCause().getMessage());
+ RESULT_MANAGER.genericError("Syncope server offline");
+ RESULT_MANAGER.genericError(e.getCause().getMessage());
}
}
@@ -73,7 +74,7 @@ public final class SyncopeAdm {
helpMessageBuilder.append("\n");
}
} catch (final IllegalAccessException | IllegalArgumentException | InstantiationException ex) {
- RESULT_MANAGER.generic(ex.getMessage());
+ RESULT_MANAGER.genericError(ex.getMessage());
}
return helpMessageBuilder.toString();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
index 39c32e6..4764d4d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.client.cli.commands;
+import java.util.List;
import java.util.Set;
import org.apache.syncope.client.cli.view.Messages;
import org.apache.syncope.common.lib.types.ConnConfProperty;
@@ -28,6 +29,10 @@ public abstract class CommonsResultManager {
Messages.printIdNotNumberDeletedMessage(what, key);
}
+ public void unnecessaryParameters(final List<String> parameters, final String helpMessage) {
+ Messages.printUnnecessaryParameters(parameters, helpMessage);
+ }
+
public void deletedMessage(final String what, final String key) {
Messages.printDeletedMessage(what, key);
}
@@ -52,10 +57,14 @@ public abstract class CommonsResultManager {
Messages.printDefaultMessage(option, helpMessage);
}
- public void generic(final String... messages) {
+ public void genericMessage(final String... messages) {
Messages.printMessage(messages);
}
-
+
+ public void genericError(final String error) {
+ Messages.printMessage("Error: " + error);
+ }
+
protected void printConfiguration(final Set<ConnConfProperty> configurationPropertys) {
for (final ConnConfProperty configuration : configurationPropertys) {
System.out.println(" name: " + configuration.getSchema().getName());
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java
index 00fe6fa..28cebf4 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java
@@ -49,7 +49,7 @@ public class ConfigurationCommand extends AbstractCommand {
switch (Options.fromName(input.getOption())) {
case GET:
- new ConfigurationGet().get();
+ new ConfigurationGet(input).get();
break;
case READ:
new ConfigurationRead(input).read();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
index 870cb27..79b679b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
@@ -42,9 +42,9 @@ public class ConfigurationDelete extends AbstractConfigurationCommand {
if (ex.getMessage().startsWith("NotFound")) {
configurationResultManager.notFoundError("Configuration", parameter);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- configurationResultManager.generic("You cannot delete configuration", parameter);
+ configurationResultManager.genericError("You cannot delete configuration " + parameter);
} else {
- configurationResultManager.generic(ex.getMessage());
+ configurationResultManager.genericError(ex.getMessage());
}
break;
}
@@ -53,5 +53,4 @@ public class ConfigurationDelete extends AbstractConfigurationCommand {
configurationResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
index d08677a..2eaeb75 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
@@ -47,22 +47,22 @@ public class ConfigurationExport extends AbstractConfigurationCommand {
XMLUtils.createXMLFile(
(SequenceInputStream) configurationSyncopeOperations.export().getEntity(),
input.firstParameter() + EXPORT_FILE_NAME);
- configurationResultManager.generic(
+ configurationResultManager.genericMessage(
input.firstParameter() + EXPORT_FILE_NAME + " successfully created");
} catch (final IOException ex) {
- configurationResultManager.generic(ex.getMessage());
+ configurationResultManager.genericError(ex.getMessage());
} catch (ParserConfigurationException | SAXException | TransformerConfigurationException ex) {
- configurationResultManager.generic(
+ configurationResultManager.genericError(
"Error creating " + input.firstParameter() + EXPORT_FILE_NAME + " " + ex.getMessage());
} catch (final TransformerException ex) {
if (ex.getCause() instanceof FileNotFoundException) {
- configurationResultManager.generic("Permission denied on " + input.firstParameter());
+ configurationResultManager.genericError("Permission denied on " + input.firstParameter());
} else {
- configurationResultManager.generic(
+ configurationResultManager.genericError(
"Error creating " + input.firstParameter() + EXPORT_FILE_NAME + " " + ex.getMessage());
}
} catch (final SyncopeClientException ex) {
- configurationResultManager.generic("Error calling configuration service " + ex.getMessage());
+ configurationResultManager.genericError("Error calling configuration service " + ex.getMessage());
}
} else {
configurationResultManager.commandOptionError(EXPORT_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
index 3cad82d..f0b7682 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
@@ -19,18 +19,27 @@
package org.apache.syncope.client.cli.commands.configuration;
import java.util.LinkedList;
+import org.apache.syncope.client.cli.Input;
public class ConfigurationGet extends AbstractConfigurationCommand {
- public ConfigurationGet() {
+ private static final String GET_HELP_MESSAGE = "configuration --get";
+
+ private final Input input;
+
+ public ConfigurationGet(final Input input) {
+ this.input = input;
}
public void get() {
- try {
- configurationResultManager.fromGet(new LinkedList<>(configurationSyncopeOperations.list()));
- } catch (final Exception ex) {
- configurationResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ configurationResultManager.fromGet(new LinkedList<>(configurationSyncopeOperations.list()));
+ } catch (final Exception ex) {
+ configurationResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ configurationResultManager.unnecessaryParameters(input.listParameters(), GET_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
index 5bccb3f..e315f33 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
@@ -45,7 +45,7 @@ public class ConfigurationRead extends AbstractConfigurationCommand {
if (ex.getMessage().startsWith("NotFound")) {
configurationResultManager.notFoundError("Configuration", parameter);
} else {
- configurationResultManager.generic(ex.getMessage());
+ configurationResultManager.genericError(ex.getMessage());
}
failed = true;
break;
@@ -58,5 +58,4 @@ public class ConfigurationRead extends AbstractConfigurationCommand {
configurationResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
index 2f85ffa..e3aff4e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
@@ -50,17 +50,18 @@ public class ConfigurationUpdate extends AbstractConfigurationCommand {
configurationSyncopeOperations.set(attrTO);
attrList.add(attrTO);
} catch (final IllegalArgumentException ex) {
- configurationResultManager.generic(ex.getMessage(), UPDATE_HELP_MESSAGE);
+ configurationResultManager.genericError(ex.getMessage());
+ configurationResultManager.genericError(UPDATE_HELP_MESSAGE);
failed = true;
break;
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
configurationResultManager.notFoundError("Configuration", pairParameter.getKey());
} else if (ex.getMessage().startsWith("InvalidValues")) {
- configurationResultManager.generic(
+ configurationResultManager.genericError(
pairParameter.getValue() + " is not a valid value for " + pairParameter.getKey());
} else {
- configurationResultManager.generic(ex.getMessage());
+ configurationResultManager.genericError(ex.getMessage());
}
failed = true;
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
index 83a03cb..c87055c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
@@ -48,10 +48,10 @@ public class ConnectorCommand extends AbstractCommand {
switch (ConnectorOptions.fromName(input.getOption())) {
case LIST:
- new ConnectorList().list();
+ new ConnectorList(input).list();
break;
case LIST_BUNDLES:
- new ConnectorListBundles().list();
+ new ConnectorListBundles(input).list();
break;
case LIST_CONFIGURATION:
new ConnectorListConfigurationProperties(input).list();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
index 6e26b9b..1454d28 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
@@ -48,15 +48,14 @@ public class ConnectorDelete extends AbstractConnectorCommand {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Connector", parameter);
} else {
- connectorResultManager.generic(ex.getMessage());
+ connectorResultManager.genericError(ex.getMessage());
}
break;
}
}
- connectorResultManager.toView(connInstanceTOs);
+ connectorResultManager.printConnectors(connInstanceTOs);
} else {
connectorResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
index f063228..1c86bbb 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
@@ -18,15 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.connector;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class ConnectorList extends AbstractConnectorCommand {
+ private static final String LIST_HELP_MESSAGE = "connector --list";
+
+ private final Input input;
+
+ public ConnectorList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- connectorResultManager.toView(connectorSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- connectorResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ connectorResultManager.printConnectors(connectorSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ connectorResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ connectorResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
index d77cd83..293fa13 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
@@ -18,15 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.connector;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class ConnectorListBundles extends AbstractConnectorCommand {
+ private static final String LIST_HELP_MESSAGE = "connector --list-bundles";
+
+ private final Input input;
+
+ public ConnectorListBundles(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- connectorResultManager.fromListBundles(connectorSyncopeOperations.getBundles());
- } catch (final SyncopeClientException ex) {
- connectorResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ connectorResultManager.printBundles(connectorSyncopeOperations.getBundles());
+ } catch (final SyncopeClientException ex) {
+ connectorResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ connectorResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
index 91a0021..5f5197c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
@@ -24,7 +24,7 @@ import org.apache.syncope.common.lib.SyncopeClientException;
public class ConnectorListConfigurationProperties extends AbstractConnectorCommand {
- private static final String LIST_CONFIGURATION_HELP_MESSAGE
+ private static final String LIST_CONFIGURATION_HELP_MESSAGE
= "connector --list-configuration-properties {CONNECTOR-ID} {CONNECTOR-ID} [...]";
private final Input input;
@@ -37,7 +37,7 @@ public class ConnectorListConfigurationProperties extends AbstractConnectorComma
if (input.getParameters().length >= 1) {
for (final String parameter : input.getParameters()) {
try {
- connectorResultManager.fromConfigurationProperties(
+ connectorResultManager.printConfigurationProperties(
connectorSyncopeOperations.read(parameter).getConf());
} catch (final NumberFormatException ex) {
connectorResultManager.numberFormatException("connector", parameter);
@@ -45,14 +45,12 @@ public class ConnectorListConfigurationProperties extends AbstractConnectorComma
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Connector", parameter);
} else {
- connectorResultManager.generic(ex.getMessage());
+ connectorResultManager.genericError(ex.getMessage());
}
- break;
}
}
} else {
connectorResultManager.commandOptionError(LIST_CONFIGURATION_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
index e2dca1e..dc29d74 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.connector;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
public class ConnectorRead extends AbstractConnectorCommand {
@@ -37,25 +34,21 @@ public class ConnectorRead extends AbstractConnectorCommand {
public void read() {
if (input.getParameters().length >= 1) {
- final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- connInstanceTOs.add(connectorSyncopeOperations.read(parameter));
+ connectorResultManager.printConnector(connectorSyncopeOperations.read(parameter));
} catch (final NumberFormatException ex) {
connectorResultManager.numberFormatException("connector", parameter);
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Connector", parameter);
} else {
- connectorResultManager.generic(ex.getMessage());
+ connectorResultManager.genericError(ex.getMessage());
}
- break;
}
}
- connectorResultManager.toView(connInstanceTOs);
} else {
connectorResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
index d062077..cc8bbac 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.client.cli.commands.connector;
-import java.util.ArrayList;
-import java.util.List;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
public class ConnectorReadByResource extends AbstractConnectorCommand {
@@ -38,23 +35,19 @@ public class ConnectorReadByResource extends AbstractConnectorCommand {
public void read() {
if (input.getParameters().length >= 1) {
- final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
for (final String parameter : input.getParameters()) {
try {
- connInstanceTOs.add(connectorSyncopeOperations.readByResource(parameter));
+ connectorResultManager.printConnector(connectorSyncopeOperations.readByResource(parameter));
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
connectorResultManager.notFoundError("Resource", parameter);
} else {
- connectorResultManager.generic(ex.getMessage());
+ connectorResultManager.genericError(ex.getMessage());
}
- break;
}
}
- connectorResultManager.toView(connInstanceTOs);
} else {
connectorResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
index 7c72349..4ff92ed 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
@@ -30,30 +30,13 @@ import org.apache.syncope.common.lib.types.ConnectorCapability;
public class ConnectorResultManager extends CommonsResultManager {
- public void toView(final List<ConnInstanceTO> connInstanceTOs) {
+ public void printConnectors(final List<ConnInstanceTO> connInstanceTOs) {
for (final ConnInstanceTO connInstanceTO : connInstanceTOs) {
printConnector(connInstanceTO);
}
}
- public void fromListBundles(final List<ConnBundleTO> connBundleTOs) {
- for (final ConnBundleTO connBundleTO : connBundleTOs) {
- System.out.println(" > BUNDLE NAME: " + connBundleTO.getBundleName());
- System.out.println(" connector name: " + connBundleTO.getConnectorName());
- System.out.println(" display name: " + connBundleTO.getDisplayName());
- System.out.println(" location: " + connBundleTO.getLocation());
- System.out.println(" version: " + connBundleTO.getVersion());
- System.out.println(" PROPERTIES:");
- printConfPropSchema(connBundleTO.getProperties());
- }
- }
-
- public void fromConfigurationProperties(final Set<ConnConfProperty> connConfPropertys) {
- printConfiguration(connConfPropertys);
-
- }
-
- private void printConnector(final ConnInstanceTO connInstanceTO) {
+ public void printConnector(final ConnInstanceTO connInstanceTO) {
System.out.println(" > CONNECTOR ID: " + connInstanceTO.getKey());
System.out.println(" bundle name: " + connInstanceTO.getBundleName());
System.out.println(" connector name: " + connInstanceTO.getConnectorName());
@@ -67,6 +50,7 @@ public class ConnectorResultManager extends CommonsResultManager {
printConfiguration(connInstanceTO.getConf());
System.out.println(" POOL CONFIGURATION:");
printConfPool(connInstanceTO.getPoolConf());
+ System.out.println("");
}
private void printCapabilities(final Set<ConnectorCapability> capabilities) {
@@ -83,6 +67,18 @@ public class ConnectorResultManager extends CommonsResultManager {
System.out.println(" max wait: " + connPoolConfTO.getMaxWait());
}
+ public void printBundles(final List<ConnBundleTO> connBundleTOs) {
+ for (final ConnBundleTO connBundleTO : connBundleTOs) {
+ System.out.println(" > BUNDLE NAME: " + connBundleTO.getBundleName());
+ System.out.println(" connector name: " + connBundleTO.getConnectorName());
+ System.out.println(" display name: " + connBundleTO.getDisplayName());
+ System.out.println(" location: " + connBundleTO.getLocation());
+ System.out.println(" version: " + connBundleTO.getVersion());
+ System.out.println(" PROPERTIES:");
+ printConfPropSchema(connBundleTO.getProperties());
+ }
+ }
+
private void printConfPropSchema(final List<ConnConfPropSchema> connConfPropSchemas) {
for (final ConnConfPropSchema connConfPropSchema : connConfPropSchemas) {
System.out.println(" name: " + connConfPropSchema.getName());
@@ -94,4 +90,9 @@ public class ConnectorResultManager extends CommonsResultManager {
System.out.println("");
}
}
+
+ public void printConfigurationProperties(final Set<ConnConfProperty> connConfPropertys) {
+ printConfiguration(connConfPropertys);
+
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
index b496063..11ac036 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
@@ -26,7 +26,7 @@ import org.apache.syncope.common.rest.api.service.ConnectorService;
public class ConnectorSyncopeOperations {
- protected final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
+ private final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
public ConnInstanceTO readByResource(final String resourceName) {
return connectorService.readByResource(resourceName, null);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
index e709b81..adda76b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
@@ -33,7 +33,7 @@ public class DomainCommand extends AbstractCommand {
+ " --help \n"
+ " --list \n"
+ " --delete \n"
- + " Syntax: --delete {DOMAIN-KEY} {DOMAIN-KEY} [...]\n";
+ + " Syntax: --delete {DOMAIN-NAME} {DOMAIN-NAME} [...]\n";
@Override
public void execute(final Input input) {
@@ -42,7 +42,7 @@ public class DomainCommand extends AbstractCommand {
}
switch (Options.fromName(input.getOption())) {
case LIST:
- new DomainList().list();
+ new DomainList(input).list();
break;
case DELETE:
new DomainDelete(input).delete();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
index f85d3c9..06e733a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
@@ -23,7 +23,7 @@ import org.apache.syncope.common.lib.SyncopeClientException;
public class DomainDelete extends AbstractDomainCommand {
- private static final String DELETE_HELP_MESSAGE = "domain --delete {DOMAIN-KEY} {DOMAIN-KEY} [...]";
+ private static final String DELETE_HELP_MESSAGE = "domain --delete {DOMAIN-NAME} {DOMAIN-NAME} [...]";
private final Input input;
@@ -41,7 +41,7 @@ public class DomainDelete extends AbstractDomainCommand {
if (ex.getMessage().startsWith("NotFound")) {
domainResultManager.notFoundError("Domain", parameter);
} else {
- domainResultManager.generic(ex.getMessage());
+ domainResultManager.genericError(ex.getMessage());
}
}
}
@@ -49,5 +49,4 @@ public class DomainDelete extends AbstractDomainCommand {
domainResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
index 6cf7b7d..7c60844 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
@@ -18,21 +18,29 @@
*/
package org.apache.syncope.client.cli.commands.domain;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.DomainTO;
public class DomainList extends AbstractDomainCommand {
- public DomainList() {
+ private static final String LIST_HELP_MESSAGE = "domain --list";
+
+ private final Input input;
+
+ public DomainList(final Input input) {
+ this.input = input;
}
public void list() {
- try {
- for (final DomainTO domainTO : domainSyncopeOperations.list()) {
- domainResultManager.generic(domainTO.getKey());
+ if (input.parameterNumber() == 0) {
+ try {
+ domainResultManager.toView(domainSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ domainResultManager.genericError(ex.getMessage());
}
- } catch (final SyncopeClientException ex) {
- domainResultManager.generic("Error: " + ex.getMessage());
+ } else {
+ domainResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
+
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
index 2eaa75a..94989ff 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
@@ -23,7 +23,7 @@ import org.apache.syncope.common.lib.SyncopeClientException;
public class DomainRead extends AbstractDomainCommand {
- private static final String READ_HELP_MESSAGE = "domain --read {DOMAIN-KEY} {DOMAIN-KEY} [...]";
+ private static final String READ_HELP_MESSAGE = "domain --read {DOMAIN-NAME} {DOMAIN-NAME} [...]";
private final Input input;
@@ -35,12 +35,12 @@ public class DomainRead extends AbstractDomainCommand {
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
try {
- domainResultManager.generic(domainSyncopeOperations.read(parameter).getKey());
+ domainResultManager.printDomain(domainSyncopeOperations.read(parameter));
} catch (final SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
domainResultManager.notFoundError("Domain", parameter);
} else {
- domainResultManager.generic(ex.getMessage());
+ domainResultManager.genericError(ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
index 6066c5d..d0b28ed 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
@@ -18,8 +18,20 @@
*/
package org.apache.syncope.client.cli.commands.domain;
+import java.util.List;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.DomainTO;
public class DomainResultManager extends CommonsResultManager {
+ public void toView(final List<DomainTO> domainTOs) {
+ for (final DomainTO domainTO : domainTOs) {
+ printDomain(domainTO);
+ }
+ }
+
+ public void printDomain(final DomainTO domainTO) {
+ System.out.println(" > DOIMAIN NAME: " + domainTO.getKey());
+ System.out.println(" chiper algorithm: " + domainTO.getAdminCipherAlgorithm());
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
index acc8aa5..f09665d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.client.cli.commands.entitlement;
-public class AbstractEntitlementCommand {
+public abstract class AbstractEntitlementCommand {
protected final EntitlementSyncopeOperations entitlementSyncopeOperations = new EntitlementSyncopeOperations();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
index 5ca478c..1dc4966 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
@@ -37,7 +37,7 @@ public class EntitlementCommand extends AbstractCommand {
+ " --read-by-username\n"
+ " Syntax: --read-by-username {USERNAME}\n"
+ " --read-by-userid\n"
- + " Syntax: --read-by-userid {USERID}\n"
+ + " Syntax: --read-by-userid {USER-ID}\n"
+ " --search-by-role\n"
+ " Syntax: --search-by-role {ROLE-ID}";
@@ -49,7 +49,7 @@ public class EntitlementCommand extends AbstractCommand {
switch (EntitlementOptions.fromName(input.getOption())) {
case LIST:
- new EntitlementList().list();
+ new EntitlementList(input).list();
break;
case READ_BY_USERNAME:
new EntitlementReadByUsername(input).read();
@@ -117,5 +117,4 @@ public class EntitlementCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
index d0c532c..e204823 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
@@ -18,9 +18,23 @@
*/
package org.apache.syncope.client.cli.commands.entitlement;
+import org.apache.syncope.client.cli.Input;
+
public class EntitlementList extends AbstractEntitlementCommand {
+ private static final String READ_HELP_MESSAGE = "entitlement --list";
+
+ private final Input input;
+
+ public EntitlementList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- entitlementResultManager.toView(entitlementSyncopeOperations.list());
+ if (input.parameterNumber() == 0) {
+ entitlementResultManager.toView(entitlementSyncopeOperations.list());
+ } else {
+ entitlementResultManager.unnecessaryParameters(input.listParameters(), READ_HELP_MESSAGE);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
index f65757c..0b4144e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
@@ -43,13 +43,13 @@ public class EntitlementListRole extends AbstractEntitlementCommand {
} else if (roleTOs != null && !roleTOs.isEmpty()) {
entitlementResultManager.rolesToView(roleTOs);
} else {
- entitlementResultManager.generic("No roles found for entitlement " + input.firstParameter());
+ entitlementResultManager.genericMessage("No roles found for entitlement " + input.firstParameter());
}
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
entitlementResultManager.notFoundError("User", input.firstParameter());
} else {
- entitlementResultManager.generic("Error: " + ex.getMessage());
+ entitlementResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
entitlementResultManager.numberFormatException("user", input.firstParameter());
@@ -58,5 +58,4 @@ public class EntitlementListRole extends AbstractEntitlementCommand {
entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
index 99f6305..3cd41cb 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserId.java
@@ -41,7 +41,7 @@ public class EntitlementReadByUserId extends AbstractEntitlementCommand {
if (ex.getMessage().startsWith("NotFound")) {
entitlementResultManager.notFoundError("User", input.firstParameter());
} else {
- entitlementResultManager.generic("Error: " + ex.getMessage());
+ entitlementResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
entitlementResultManager.numberFormatException("user", input.firstParameter());
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
index bfcec00..40a73fc 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
@@ -41,7 +41,7 @@ public class EntitlementReadByUsername extends AbstractEntitlementCommand {
if (ex.getMessage().startsWith("NotFound")) {
entitlementResultManager.notFoundError("User", input.firstParameter());
} else {
- entitlementResultManager.generic("Error: " + ex.getMessage());
+ entitlementResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
entitlementResultManager.numberFormatException("user", input.firstParameter());
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
index 01585d2..e6003ad 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
@@ -50,5 +50,4 @@ public class EntitlementResultManager extends CommonsResultManager {
System.out.println(" - " + realm);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
index 6d756f0..91f9828 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
@@ -41,7 +41,7 @@ public class EntitlementSearchByRole extends AbstractEntitlementCommand {
if (ex.getMessage().startsWith("NotFound")) {
entitlementResultManager.notFoundError("User", input.firstParameter());
} else {
- entitlementResultManager.generic("Error: " + ex.getMessage());
+ entitlementResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
entitlementResultManager.numberFormatException("user", input.firstParameter());
@@ -50,5 +50,4 @@ public class EntitlementSearchByRole extends AbstractEntitlementCommand {
entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java
index c658beb..0492a26 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java
@@ -24,6 +24,8 @@ import org.apache.syncope.client.cli.util.CommandUtils;
public class Help {
+ private final HelpResultManager helpResultManager = new HelpResultManager();
+
public void help() {
final StringBuilder generalHelpBuilder = new StringBuilder("General help\n");
try {
@@ -35,9 +37,9 @@ public class Help {
.append("\n")
.append(" \n");
}
- System.out.println(generalHelpBuilder.toString());
+ helpResultManager.toView(generalHelpBuilder.toString());
} catch (final IllegalAccessException | IllegalArgumentException | InstantiationException e) {
- new HelpResultManager().generic(e.getMessage());
+ helpResultManager.genericMessage(e.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java
index 7a67943..b70664d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java
@@ -22,4 +22,7 @@ import org.apache.syncope.client.cli.commands.CommonsResultManager;
public class HelpResultManager extends CommonsResultManager {
+ public void toView(final String generalHelp) {
+ System.out.println(generalHelp);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java
index ccf9170..4fa0163 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java
@@ -25,219 +25,188 @@ import org.apache.syncope.common.rest.api.service.SyncopeService;
public class Info {
private final SyncopeTO syncopeTO = SyncopeServices.get(SyncopeService.class).info();
-
+
private final InfoResultManager infoResultManager = new InfoResultManager();
public void version() {
try {
- infoResultManager.generic("Syncope version: " + syncopeTO.getVersion());
+ infoResultManager.printVersion(syncopeTO.getVersion());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void pwdResetAllowed() {
try {
- infoResultManager.generic("Password reset allowed: " + syncopeTO.isPwdResetAllowed());
+ infoResultManager.printPwdResetAllowed(syncopeTO.isPwdResetAllowed());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void resetWithSecurityQuestion() {
try {
- infoResultManager.generic("Password reset requiring security question: "
- + syncopeTO.isPwdResetRequiringSecurityQuestions());
+ infoResultManager.printPwdResetRequiringSecurityQuestions(syncopeTO.isPwdResetRequiringSecurityQuestions());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void selfRegistrationAllowed() {
try {
- infoResultManager.generic("Self registration allowed: " + syncopeTO.isSelfRegAllowed());
+ infoResultManager.printSelfRegistrationAllowed(syncopeTO.isSelfRegAllowed());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void provisioningManager() {
try {
- infoResultManager.generic(
- "Any object provisioning manager class: " + syncopeTO.getAnyObjectProvisioningManager(),
- "User provisioning manager class: " + syncopeTO.getUserProvisioningManager(),
- "Group provisioning manager class: " + syncopeTO.getGroupProvisioningManager());
+ infoResultManager.printProvisioningManager(
+ syncopeTO.getAnyObjectProvisioningManager(),
+ syncopeTO.getUserProvisioningManager(),
+ syncopeTO.getGroupProvisioningManager());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void workflowAdapter() {
try {
- infoResultManager.generic(
- "Any object workflow adapter class: " + syncopeTO.getAnyObjectWorkflowAdapter(),
- "User workflow adapter class: " + syncopeTO.getUserWorkflowAdapter(),
- "Group workflow adapter class: " + syncopeTO.getGroupWorkflowAdapter());
+ infoResultManager.printWorkflowAdapter(
+ syncopeTO.getAnyObjectWorkflowAdapter(),
+ syncopeTO.getUserWorkflowAdapter(),
+ syncopeTO.getGroupWorkflowAdapter());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void accountRules() {
try {
- for (final String accountRule : syncopeTO.getAccountRules()) {
- infoResultManager.generic("Account rule: " + accountRule);
- }
+ infoResultManager.printAccountRules(syncopeTO.getAccountRules());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void connidLocation() {
try {
- for (final String location : syncopeTO.getConnIdLocations()) {
- infoResultManager.generic("ConnId location: " + location);
- }
+ infoResultManager.printConnidLocations(syncopeTO.getConnIdLocations());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void logicActions() {
try {
- for (final String logic : syncopeTO.getLogicActions()) {
- infoResultManager.generic("Logic action: " + logic);
- }
+ infoResultManager.printLogicActions(syncopeTO.getLogicActions());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void mailTemplates() {
try {
- for (final String template : syncopeTO.getMailTemplates()) {
- infoResultManager.generic("Mail template: " + template);
- }
+ infoResultManager.printMailTemplates(syncopeTO.getMailTemplates());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void mappingItemTransformers() {
try {
- for (final String tranformer : syncopeTO.getMappingItemTransformers()) {
- infoResultManager.generic("Mapping item tranformer: " + tranformer);
- }
+ infoResultManager.printMappingItemTransformers(syncopeTO.getMappingItemTransformers());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void passwordRules() {
try {
- for (final String rules : syncopeTO.getPasswordRules()) {
- infoResultManager.generic("Password rule: " + rules);
- }
+ infoResultManager.printPasswordRules(syncopeTO.getPasswordRules());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void propagationActions() {
try {
- for (final String action : syncopeTO.getPropagationActions()) {
- infoResultManager.generic("Propagation action: " + action);
- }
+ infoResultManager.printPropagationActions(syncopeTO.getPropagationActions());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void pushActions() {
try {
- for (final String action : syncopeTO.getPushActions()) {
- infoResultManager.generic("Push action: " + action);
- }
+ infoResultManager.printPushActions(syncopeTO.getPushActions());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void pushCorrelationActions() {
try {
- for (final String rule : syncopeTO.getPushCorrelationRules()) {
- infoResultManager.generic("Push correlation rule: " + rule);
- }
+ infoResultManager.printCorrelationActions(syncopeTO.getPushCorrelationRules());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void reportlets() {
try {
- for (final String reportlet : syncopeTO.getReportlets()) {
- infoResultManager.generic("Reportlet: " + reportlet);
- }
+ infoResultManager.printReportlets(syncopeTO.getReportlets());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void syncActions() {
try {
- for (final String action : syncopeTO.getSyncActions()) {
- infoResultManager.generic("Sync action: " + action);
- }
+ infoResultManager.printSyncActions(syncopeTO.getSyncActions());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void syncCorrelationRules() {
try {
- for (final String rule : syncopeTO.getSyncCorrelationRules()) {
- infoResultManager.generic("Sync correlation rule: " + rule);
- }
+ infoResultManager.printCorrelationRules(syncopeTO.getSyncCorrelationRules());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void taskJobs() {
try {
- for (final String job : syncopeTO.getTaskJobs()) {
- infoResultManager.generic("Task job: " + job);
- }
+ infoResultManager.printJobs(syncopeTO.getTaskJobs());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void validators() {
try {
- for (final String validator : syncopeTO.getValidators()) {
- infoResultManager.generic("Validator: " + validator);
- }
+ infoResultManager.printValidators(syncopeTO.getValidators());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void passwordGenerators() {
try {
- infoResultManager.generic(
- "Password generator class: " + syncopeTO.getPasswordGenerator());
+ infoResultManager.printPasswordGenerator(syncopeTO.getPasswordGenerator());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
public void virAttrCache() {
try {
- infoResultManager.generic(
- "Virtual attribute cache class: " + syncopeTO.getVirAttrCache());
+ infoResultManager.printVirtualAttributeCacheClass(syncopeTO.getVirAttrCache());
} catch (final Exception ex) {
- infoResultManager.generic(ex.getMessage());
+ infoResultManager.genericError(ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java
index 237af64..6ea04f7 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java
@@ -18,8 +18,134 @@
*/
package org.apache.syncope.client.cli.commands.info;
+import java.util.List;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
public class InfoResultManager extends CommonsResultManager {
+ public void printVersion(final String version) {
+ genericMessage(" - Syncope version: " + version);
+ }
+
+ public void printPwdResetAllowed(final boolean pwdResetAllowed) {
+ genericMessage("Password reset allowed: " + pwdResetAllowed);
+ }
+
+ public void printPwdResetRequiringSecurityQuestions(final boolean pwdResetRequiringSecurityQuestions) {
+ genericMessage("Password reset requiring security question: " + pwdResetRequiringSecurityQuestions);
+ }
+
+ public void printSelfRegistrationAllowed(final boolean selfRegAllowed) {
+ genericMessage("Self registration allowed: " + selfRegAllowed);
+ }
+
+ public void printProvisioningManager(final String anyObjectProvisioningManager,
+ final String getUserProvisioningManager,
+ final String getGroupProvisioningManager) {
+ genericMessage(
+ "Any object provisioning manager class: " + anyObjectProvisioningManager,
+ "User provisioning manager class: " + getUserProvisioningManager,
+ "Group provisioning manager class: " + getGroupProvisioningManager);
+ }
+
+ public void printWorkflowAdapter(final String anyObjectWorkflowAdapter,
+ final String userWorkflowAdapter,
+ final String groupWorkflowAdapter) {
+ genericMessage(
+ "Any object workflow adapter class: " + anyObjectWorkflowAdapter,
+ "User workflow adapter class: " + userWorkflowAdapter,
+ "Group workflow adapter class: " + groupWorkflowAdapter);
+ }
+
+ public void printAccountRules(final List<String> rules) {
+ for (final String accountRule : rules) {
+ genericMessage("Account rule: " + accountRule);
+ }
+ }
+
+ public void printConnidLocations(final List<String> locations) {
+ for (final String location : locations) {
+ genericMessage("ConnId location: " + location);
+ }
+ }
+
+ public void printLogicActions(final List<String> actions) {
+ for (final String action : actions) {
+ genericMessage("Logic action: " + action);
+ }
+ }
+
+ public void printMailTemplates(final List<String> mailTemplates) {
+ for (final String template : mailTemplates) {
+ genericMessage("Mail template: " + template);
+ }
+ }
+
+ public void printMappingItemTransformers(final List<String> transformers) {
+ for (final String tranformer : transformers) {
+ genericMessage("Mapping item tranformer: " + tranformer);
+ }
+ }
+
+ public void printPasswordRules(final List<String> rules) {
+ for (final String rule : rules) {
+ genericMessage("Password rule: " + rule);
+ }
+ }
+
+ public void printCorrelationRules(final List<String> rules) {
+ for (final String rule : rules) {
+ genericMessage("Correlation rule: " + rule);
+ }
+ }
+
+ public void printPropagationActions(final List<String> actions) {
+ for (final String action : actions) {
+ genericMessage("Propagation action: " + action);
+ }
+ }
+
+ public void printPushActions(final List<String> actions) {
+ for (final String action : actions) {
+ genericMessage("Push action: " + action);
+ }
+ }
+
+ public void printSyncActions(final List<String> actions) {
+ for (final String action : actions) {
+ genericMessage("Sync action: " + action);
+ }
+ }
+
+ public void printCorrelationActions(final List<String> actions) {
+ for (final String action : actions) {
+ genericMessage("Push correlation rule: " + action);
+ }
+ }
+
+ public void printReportlets(final List<String> reportlets) {
+ for (final String reportlet : reportlets) {
+ genericMessage("Reportlet: " + reportlet);
+ }
+ }
+
+ public void printJobs(final List<String> jobs) {
+ for (final String job : jobs) {
+ genericMessage("Task job: " + job);
+ }
+ }
+
+ public void printValidators(final List<String> validators) {
+ for (final String validator : validators) {
+ genericMessage("Validator: " + validator);
+ }
+ }
+
+ public void printPasswordGenerator(final String passwordGenerator) {
+ genericMessage("Password generator class: " + passwordGenerator);
+ }
+
+ public void printVirtualAttributeCacheClass(final String virAttrCache) {
+ genericMessage("Virtual attribute cache class: " + virAttrCache);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
index 7ebd554..b9f4c83 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.client.cli.commands.install;
+import java.io.FileNotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.cli.Command;
import org.apache.syncope.client.cli.Input;
@@ -26,6 +27,8 @@ import org.apache.syncope.client.cli.commands.AbstractCommand;
@Command(name = "install")
public class InstallCommand extends AbstractCommand {
+ private final InstallResultManager installResultManager = new InstallResultManager();
+
private static final String HELP_MESSAGE = "Usage: install [options]\n"
+ " Options:\n"
+ " --help \n"
@@ -39,13 +42,18 @@ public class InstallCommand extends AbstractCommand {
switch (Options.fromName(input.getOption())) {
case INSTALL:
- new InstallSetup().setup();
+ try {
+ new InstallSetup().setup();
+ } catch (final FileNotFoundException | IllegalAccessException ex) {
+ installResultManager.genericError(ex.getMessage());
+ break;
+ }
break;
case HELP:
System.out.println(HELP_MESSAGE);
break;
default:
- new InstallResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+ installResultManager.defaultError(input.getOption(), HELP_MESSAGE);
}
}
@@ -83,5 +91,4 @@ public class InstallCommand extends AbstractCommand {
return optionToReturn;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java
index 8b96ae0..39837bf 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java
@@ -26,6 +26,16 @@ import org.apache.syncope.client.cli.commands.CommonsResultManager;
public class InstallResultManager extends CommonsResultManager {
+ public void printWelcome() {
+ System.out.println("");
+ System.out.println("###############################################");
+ System.out.println("# #");
+ System.out.println("# Welcome to Syncope CLI installation process #");
+ System.out.println("# #");
+ System.out.println("###############################################");
+ System.out.println("");
+ }
+
public void installationSuccessful(final String version) {
System.out.println("Installation parameters checked on Syncope core version: " + version);
System.out.println("");
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
index 4d9a0ff..7e1eaec 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
@@ -44,23 +44,18 @@ public class InstallSetup {
private String syncopeServerRestContext = "/syncope/rest/";
- public InstallSetup() {
- }
-
- public void setup() {
- System.out.println("");
- System.out.println("###############################################");
- System.out.println("# #");
- System.out.println("# Welcome to Syncope CLI installation process #");
- System.out.println("# #");
- System.out.println("###############################################");
- System.out.println("");
+ public void setup() throws FileNotFoundException, IllegalAccessException {
+ installResultManager.printWelcome();
System.out.println("Path to config files of Syncope CLI client will be: "
+ InstallConfigFileTemplate.DIR_PATH);
+ if (!FileSystemUtils.exists(InstallConfigFileTemplate.DIR_PATH)) {
+ throw new FileNotFoundException("Directory: " + InstallConfigFileTemplate.DIR_PATH + " does not exists!");
+ }
+
if (!FileSystemUtils.canWrite(InstallConfigFileTemplate.DIR_PATH)) {
- System.out.println("Permission denied on " + InstallConfigFileTemplate.DIR_PATH);
+ throw new IllegalAccessException("Permission denied on " + InstallConfigFileTemplate.DIR_PATH);
}
System.out.println("- File system permission checked");
System.out.println("");
@@ -153,7 +148,6 @@ public class InstallSetup {
scanIn.close();
final JasyptUtils jasyptUtils = JasyptUtils.getJasyptUtils();
-
try {
FileSystemUtils.createNewDirectory(InstallConfigFileTemplate.DIR_PATH);
final String contentCliPropertiesFile = InstallConfigFileTemplate.createFile(
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
index 134c294..4d2a55e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
@@ -51,7 +51,7 @@ public class LoggerCommand extends AbstractCommand {
switch (LoggerOptions.fromName(input.getOption())) {
case LIST:
- new LoggerList().list();
+ new LoggerList(input).list();
break;
case READ:
new LoggerRead(input).read();
@@ -123,5 +123,4 @@ public class LoggerCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
index 40b5e1b..2216295 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
@@ -65,5 +65,4 @@ public class LoggerCreate extends AbstractLoggerCommand {
loggerResultManager.commandOptionError(CREATE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
index 8bdb3ab..88c30c5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
@@ -42,7 +42,7 @@ public class LoggerDelete extends AbstractLoggerCommand {
if (ex.getMessage().startsWith("NotFound")) {
loggerResultManager.notFoundError("Logger", parameter);
} else {
- loggerResultManager.generic(ex.getMessage());
+ loggerResultManager.genericError(ex.getMessage());
}
}
}
@@ -50,5 +50,4 @@ public class LoggerDelete extends AbstractLoggerCommand {
loggerResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
[19/50] [abbrv] syncope git commit: unused import
Posted by fm...@apache.org.
unused import
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1ebc0bcd
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1ebc0bcd
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1ebc0bcd
Branch: refs/heads/SYNCOPE-156
Commit: 1ebc0bcd0c61a7b7d41de3d28ee3a718a78ebe8f
Parents: 3c36fe1
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 28 17:27:10 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 28 17:27:10 2015 +0100
----------------------------------------------------------------------
.../main/java/org/apache/syncope/common/lib/types/Entitlement.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/1ebc0bcd/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
index 746a95b..6587d1d 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
@@ -21,7 +21,6 @@ package org.apache.syncope.common.lib.types;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
[15/50] [abbrv] syncope git commit: Fixed SYNCOPE-591
Posted by fm...@apache.org.
Fixed SYNCOPE-591
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/435e59db
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/435e59db
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/435e59db
Branch: refs/heads/SYNCOPE-156
Commit: 435e59db756bbfcd836f651010cc9e4a61ba2957
Parents: 74e867e
Author: massi <ma...@tirasa.net>
Authored: Wed Oct 28 12:11:19 2015 +0100
Committer: massi <ma...@tirasa.net>
Committed: Wed Oct 28 12:11:19 2015 +0100
----------------------------------------------------------------------
.../question/AbstractQuestionCommand.java | 27 +++++
.../cli/commands/question/QuestionCommand.java | 114 +++++++++++++++++++
.../cli/commands/question/QuestionDelete.java | 57 ++++++++++
.../cli/commands/question/QuestionList.java | 32 ++++++
.../cli/commands/question/QuestionRead.java | 61 ++++++++++
.../commands/question/QuestionReadByUser.java | 53 +++++++++
.../question/QuestionResultManager.java | 38 +++++++
.../question/QuestionSyncopeOperations.java | 46 ++++++++
.../cli/commands/role/AbstractRoleCommand.java | 6 +-
.../client/cli/commands/role/RoleDelete.java | 2 +-
10 files changed, 432 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java
new file mode 100644
index 0000000..0a3846a
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java
@@ -0,0 +1,27 @@
+/*
+ * 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.cli.commands.question;
+
+public abstract class AbstractQuestionCommand {
+
+ protected final QuestionSyncopeOperations questionSyncopeOperations = new QuestionSyncopeOperations();
+
+ protected final QuestionResultManager questionResultManager = new QuestionResultManager();
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
new file mode 100644
index 0000000..2427203
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
@@ -0,0 +1,114 @@
+/*
+ * 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.cli.commands.question;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.cli.Command;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.client.cli.commands.AbstractCommand;
+
+@Command(name = "question")
+public class QuestionCommand extends AbstractCommand {
+
+ private static final String HELP_MESSAGE = "Usage: question [options]\n"
+ + " Options:\n"
+ + " --help \n"
+ + " --list \n"
+ + " --read \n"
+ + " Syntax: --read {QUESTION-ID} {QUESTION-ID} [...]\n"
+ + " --read-by-user \n"
+ + " Syntax: --read-by-user {USERNAME}\n"
+ + " --delete \n"
+ + " Syntax: --delete {QUESTION-ID} {QUESTION-ID} [...]";
+
+ @Override
+ public void execute(final Input input) {
+ if (StringUtils.isBlank(input.getOption())) {
+ input.setOption(QuestionOptions.HELP.getOptionName());
+ }
+
+ switch (QuestionOptions.fromName(input.getOption())) {
+ case LIST:
+ new QuestionList().list();
+ break;
+ case READ:
+ new QuestionRead(input).read();
+ break;
+ case READ_BY_USER:
+ new QuestionReadByUser(input).read();
+ break;
+ case DELETE:
+ break;
+ case HELP:
+ System.out.println(HELP_MESSAGE);
+ break;
+ default:
+ new QuestionResultManager().defaultError(input.getOption(), HELP_MESSAGE);
+ }
+ }
+
+ @Override
+ public String getHelpMessage() {
+ return HELP_MESSAGE;
+ }
+
+ private enum QuestionOptions {
+
+ HELP("--help"),
+ LIST("--list"),
+ READ("--read"),
+ READ_BY_USER("--read-by-user"),
+ DELETE("--delete");
+
+ private final String optionName;
+
+ QuestionOptions(final String optionName) {
+ this.optionName = optionName;
+ }
+
+ public String getOptionName() {
+ return optionName;
+ }
+
+ public boolean equalsOptionName(final String otherName) {
+ return (otherName == null) ? false : optionName.equals(otherName);
+ }
+
+ public static QuestionOptions fromName(final String name) {
+ QuestionOptions optionToReturn = HELP;
+ for (final QuestionOptions option : QuestionOptions.values()) {
+ if (option.equalsOptionName(name)) {
+ optionToReturn = option;
+ }
+ }
+ return optionToReturn;
+ }
+
+ public static List<String> toList() {
+ final List<String> options = new ArrayList<>();
+ for (final QuestionOptions value : values()) {
+ options.add(value.getOptionName());
+ }
+ return options;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
new file mode 100644
index 0000000..d57ae5c
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
@@ -0,0 +1,57 @@
+/*
+ * 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.cli.commands.question;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class QuestionDelete extends AbstractQuestionCommand {
+
+ private static final String DELETE_HELP_MESSAGE = "question --delete {QUESTION-ID} {QUESTION-ID} [...]";
+
+ private final Input input;
+
+ public QuestionDelete(final Input input) {
+ this.input = input;
+ }
+
+ public void delete() {
+ if (input.getParameters().length >= 1) {
+ for (final String parameter : input.getParameters()) {
+ try {
+ questionSyncopeOperations.delete(parameter);
+ questionResultManager.deletedMessage("security question", parameter);
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ questionResultManager.notFoundError("Security question", parameter);
+ } else {
+ questionResultManager.generic("Error: " + ex.getMessage());
+ }
+ break;
+ } catch (final NumberFormatException ex) {
+ questionResultManager.numberFormatException("security question", parameter);
+ }
+ }
+ } else {
+ questionResultManager.commandOptionError(DELETE_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
new file mode 100644
index 0000000..836554a
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
@@ -0,0 +1,32 @@
+/*
+ * 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.cli.commands.question;
+
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class QuestionList extends AbstractQuestionCommand {
+
+ public void list() {
+ try {
+ questionResultManager.toView(questionSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ questionResultManager.generic(ex.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
new file mode 100644
index 0000000..5f96cd5
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
@@ -0,0 +1,61 @@
+/*
+ * 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.cli.commands.question;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.SecurityQuestionTO;
+
+public class QuestionRead extends AbstractQuestionCommand {
+
+ private static final String READ_HELP_MESSAGE = "question --read {QUESTION-ID} {QUESTION-ID} [...]";
+
+ private final Input input;
+
+ public QuestionRead(final Input input) {
+ this.input = input;
+ }
+
+ public void read() {
+ if (input.getParameters().length >= 1) {
+ final List<SecurityQuestionTO> questionTOs = new ArrayList<>();
+ for (final String parameter : input.getParameters()) {
+ try {
+ questionTOs.add(questionSyncopeOperations.read(parameter));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ questionResultManager.notFoundError("Security question", parameter);
+ } else {
+ questionResultManager.generic("Error: " + ex.getMessage());
+ }
+ break;
+ } catch (final NumberFormatException ex) {
+ questionResultManager.numberFormatException("security question", parameter);
+ }
+ }
+ questionResultManager.toView(questionTOs);
+ } else {
+ questionResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java
new file mode 100644
index 0000000..fa7b23d
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionReadByUser.java
@@ -0,0 +1,53 @@
+/*
+ * 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.cli.commands.question;
+
+import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
+import org.apache.syncope.common.lib.SyncopeClientException;
+
+public class QuestionReadByUser extends AbstractQuestionCommand {
+
+ private static final String READ_HELP_MESSAGE = "question --read-by-user {USERNAME}";
+
+ private final Input input;
+
+ public QuestionReadByUser(final Input input) {
+ this.input = input;
+ }
+
+ public void read() {
+ if (input.getParameters().length == 1) {
+ try {
+ questionResultManager.printQuestion(questionSyncopeOperations.readByUser(input.firstParameter()));
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ if (ex.getMessage().startsWith("NotFound")) {
+ questionResultManager.notFoundError("Security question", input.firstParameter());
+ } else {
+ questionResultManager.generic("Error: " + ex.getMessage());
+ }
+ } catch (final NumberFormatException ex) {
+ questionResultManager.numberFormatException("security question", input.firstParameter());
+ }
+ } else {
+ questionResultManager.commandOptionError(READ_HELP_MESSAGE);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java
new file mode 100644
index 0000000..761b56b
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java
@@ -0,0 +1,38 @@
+/*
+ * 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.cli.commands.question;
+
+import java.util.List;
+import org.apache.syncope.client.cli.commands.CommonsResultManager;
+import org.apache.syncope.common.lib.to.SecurityQuestionTO;
+
+public class QuestionResultManager extends CommonsResultManager {
+
+ public void toView(final List<SecurityQuestionTO> questionTOs) {
+ for (final SecurityQuestionTO questionTO : questionTOs) {
+ printQuestion(questionTO);
+ }
+ }
+
+ public void printQuestion(final SecurityQuestionTO securityQuestionTO) {
+ System.out.println(" > SECURITY QUESTION ID: " + securityQuestionTO.getKey());
+ System.out.println(" content: " + securityQuestionTO.getContent());
+ System.out.println("");
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
new file mode 100644
index 0000000..238a576
--- /dev/null
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cli.commands.question;
+
+import java.util.List;
+import org.apache.syncope.client.cli.SyncopeServices;
+import org.apache.syncope.common.lib.to.SecurityQuestionTO;
+import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
+
+public class QuestionSyncopeOperations {
+
+ private final SecurityQuestionService securityQuestionService = SyncopeServices.get(SecurityQuestionService.class);
+
+ public List<SecurityQuestionTO> list() {
+ return securityQuestionService.list();
+ }
+
+ public void delete(final String questionId) {
+ securityQuestionService.delete(Long.valueOf(questionId));
+ }
+
+ public SecurityQuestionTO read(final String questionId) {
+ return securityQuestionService.read(Long.valueOf(questionId));
+ }
+
+ public SecurityQuestionTO readByUser(final String username) {
+ return securityQuestionService.readByUser(username);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
index b4709a0..de4aac6 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/AbstractRoleCommand.java
@@ -18,10 +18,10 @@
*/
package org.apache.syncope.client.cli.commands.role;
-public class AbstractRoleCommand {
+public abstract class AbstractRoleCommand {
- protected RoleSyncopeOperations roleSyncopeOperations = new RoleSyncopeOperations();
+ protected final RoleSyncopeOperations roleSyncopeOperations = new RoleSyncopeOperations();
- protected RoleResultManager roleResultManager = new RoleResultManager();
+ protected final RoleResultManager roleResultManager = new RoleResultManager();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/435e59db/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
index 50ac248..e47a40e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
@@ -46,7 +46,7 @@ public class RoleDelete extends AbstractRoleCommand {
}
break;
} catch (final NumberFormatException ex) {
- roleResultManager.numberFormatException("user", parameter);
+ roleResultManager.numberFormatException("role", parameter);
}
}
} else {
[31/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AnyObjectSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AnyObjectSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AnyObjectSyncResultHandlerImpl.java
index 079529d..75703b3 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AnyObjectSyncResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/AnyObjectSyncResultHandlerImpl.java
@@ -32,7 +32,7 @@ import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyUtils;
import org.apache.syncope.core.provisioning.api.ProvisioningManager;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.provisioning.api.sync.AnyObjectSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -81,11 +81,11 @@ public class AnyObjectSyncResultHandlerImpl extends AbstractSyncResultHandler im
}
@Override
- protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningResult result) {
+ protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningReport result) {
AnyObjectTO anyObjectTO = AnyObjectTO.class.cast(anyTO);
Map.Entry<Long, List<PropagationStatus>> created = anyObjectProvisioningManager.create(
- anyObjectTO, Collections.singleton(profile.getTask().getResource().getKey()));
+ anyObjectTO, Collections.singleton(profile.getTask().getResource().getKey()), true);
result.setKey(created.getKey());
result.setName(getName(anyTO));
@@ -98,11 +98,12 @@ public class AnyObjectSyncResultHandlerImpl extends AbstractSyncResultHandler im
final AnyTO before,
final AnyPatch anyPatch,
final SyncDelta delta,
- final ProvisioningResult result) {
+ final ProvisioningReport result) {
AnyObjectPatch anyObjectPatch = AnyObjectPatch.class.cast(anyPatch);
- Map.Entry<Long, List<PropagationStatus>> updated = anyObjectProvisioningManager.update(anyObjectPatch);
+ Map.Entry<Long, List<PropagationStatus>> updated =
+ anyObjectProvisioningManager.update(anyObjectPatch, true);
AnyObjectTO after = anyObjectDataBinder.getAnyObjectTO(updated.getKey());
result.setName(getName(after));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
index 35e50f9..4032b23 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DBPasswordSyncActions.java
@@ -32,7 +32,7 @@ import org.apache.syncope.core.persistence.api.entity.ConnInstance;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.Connector;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.identityconnectors.framework.common.objects.SyncDelta;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
@@ -128,7 +128,7 @@ public class DBPasswordSyncActions extends DefaultSyncActions {
final ProvisioningProfile<?, ?> profile,
final SyncDelta delta,
final A any,
- final ProvisioningResult result) throws JobExecutionException {
+ final ProvisioningReport result) throws JobExecutionException {
if (any instanceof UserTO && encodedPassword != null && cipher != null) {
User syncopeUser = userDAO.find(any.getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultPushActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultPushActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultPushActions.java
index 15f06e0..bb75f66 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultPushActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultPushActions.java
@@ -21,7 +21,7 @@ package org.apache.syncope.core.provisioning.java.sync;
import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.provisioning.api.sync.PushActions;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.quartz.JobExecutionException;
/**
@@ -77,7 +77,7 @@ public abstract class DefaultPushActions implements PushActions {
@Override
public <A extends Any<?, ?>> void onError(
- final ProvisioningProfile<?, ?> profile, final A any, final ProvisioningResult result,
+ final ProvisioningProfile<?, ?> profile, final A any, final ProvisioningReport result,
final Exception error) throws JobExecutionException {
// do nothing
@@ -85,7 +85,7 @@ public abstract class DefaultPushActions implements PushActions {
@Override
public <A extends Any<?, ?>> void after(
- final ProvisioningProfile<?, ?> profile, final A any, final ProvisioningResult result)
+ final ProvisioningProfile<?, ?> profile, final A any, final ProvisioningReport result)
throws JobExecutionException {
// do nothing
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultSyncActions.java
index 455a799..1612b6d 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/DefaultSyncActions.java
@@ -22,7 +22,7 @@ import org.apache.syncope.common.lib.patch.AnyPatch;
import org.apache.syncope.common.lib.to.AnyTO;
import org.apache.syncope.core.provisioning.api.sync.SyncActions;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.identityconnectors.framework.common.objects.SyncDelta;
import org.quartz.JobExecutionException;
@@ -103,14 +103,14 @@ public abstract class DefaultSyncActions implements SyncActions {
@Override
public void onError(
- final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final ProvisioningResult result,
+ final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final ProvisioningReport result,
final Exception error) throws JobExecutionException {
}
@Override
public <A extends AnyTO> void after(
final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final A any,
- final ProvisioningResult result)
+ final ProvisioningReport result)
throws JobExecutionException {
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
index c3b9eda..db05ccd 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/GroupSyncResultHandlerImpl.java
@@ -34,7 +34,7 @@ import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyUtils;
import org.apache.syncope.core.provisioning.api.ProvisioningManager;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.provisioning.api.sync.GroupSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -90,11 +90,14 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
}
@Override
- protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningResult result) {
+ protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningReport result) {
GroupTO groupTO = GroupTO.class.cast(anyTO);
Map.Entry<Long, List<PropagationStatus>> created = groupProvisioningManager.create(
- groupTO, groupOwnerMap, Collections.singleton(profile.getTask().getResource().getKey()));
+ groupTO,
+ groupOwnerMap,
+ Collections.singleton(profile.getTask().getResource().getKey()),
+ true);
result.setKey(created.getKey());
result.setName(getName(anyTO));
@@ -107,11 +110,11 @@ public class GroupSyncResultHandlerImpl extends AbstractSyncResultHandler implem
final AnyTO before,
final AnyPatch anyPatch,
final SyncDelta delta,
- final ProvisioningResult result) {
+ final ProvisioningReport result) {
GroupPatch groupPatch = GroupPatch.class.cast(anyPatch);
- Map.Entry<Long, List<PropagationStatus>> updated = groupProvisioningManager.update(groupPatch);
+ Map.Entry<Long, List<PropagationStatus>> updated = groupProvisioningManager.update(groupPatch, true);
String groupOwner = null;
for (AttrPatch attrPatch : groupPatch.getPlainAttrs()) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
index 59e8c42..ff81b02 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPMembershipSyncActions.java
@@ -46,7 +46,7 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationException
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.misc.AuditManager;
import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -317,7 +317,7 @@ public class LDAPMembershipSyncActions extends DefaultSyncActions {
final ProvisioningProfile<?, ?> profile,
final SyncDelta delta,
final A any,
- final ProvisioningResult result) throws JobExecutionException {
+ final ProvisioningReport result) throws JobExecutionException {
if (!(profile.getTask() instanceof SyncTask)) {
return;
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
index c58537e..3f08704 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/LDAPPasswordSyncActions.java
@@ -27,7 +27,7 @@ import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.syncope.core.persistence.api.dao.UserDAO;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.sync.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.identityconnectors.framework.common.objects.SyncDelta;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
@@ -106,7 +106,7 @@ public class LDAPPasswordSyncActions extends DefaultSyncActions {
final ProvisioningProfile<?, ?> profile,
final SyncDelta delta,
final A any,
- final ProvisioningResult result) throws JobExecutionException {
+ final ProvisioningReport result) throws JobExecutionException {
if (any instanceof UserTO && encodedPassword != null && cipher != null) {
User syncopeUser = userDAO.find(any.getKey());
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
index 34fde4d..14ba28e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/PlainAttrsSyncCorrelationRule.java
@@ -18,8 +18,6 @@
*/
package org.apache.syncope.core.provisioning.java.sync;
-import static org.apache.syncope.core.misc.utils.MappingUtils.getMappingItemTransformers;
-
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -66,7 +64,9 @@ public class PlainAttrsSyncCorrelationRule implements SyncCorrelationRule {
}
List<Object> values = attr.getValue();
- for (MappingItemTransformer transformer : getMappingItemTransformers(mappingItems.get(schema))) {
+ for (MappingItemTransformer transformer
+ : MappingUtils.getMappingItemTransformers(mappingItems.get(schema))) {
+
values = transformer.beforeSync(values);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
index 23e209c..530319e 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/sync/UserSyncResultHandlerImpl.java
@@ -32,7 +32,7 @@ import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.persistence.api.entity.AnyUtils;
import org.apache.syncope.core.provisioning.api.ProvisioningManager;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.apache.syncope.core.provisioning.api.sync.UserSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
@@ -83,13 +83,13 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
}
@Override
- protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningResult result) {
+ protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningReport result) {
UserTO userTO = UserTO.class.cast(anyTO);
Boolean enabled = syncUtilities.readEnabled(delta.getObject(), profile.getTask());
Map.Entry<Long, List<PropagationStatus>> created =
userProvisioningManager.create(userTO, true, true, enabled,
- Collections.singleton(profile.getTask().getResource().getKey()));
+ Collections.singleton(profile.getTask().getResource().getKey()), true);
result.setKey(created.getKey());
result.setName(getName(anyTO));
@@ -102,16 +102,17 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
final AnyTO before,
final AnyPatch anyPatch,
final SyncDelta delta,
- final ProvisioningResult result) {
+ final ProvisioningReport result) {
UserPatch userPatch = UserPatch.class.cast(anyPatch);
Boolean enabled = syncUtilities.readEnabled(delta.getObject(), profile.getTask());
Map.Entry<Long, List<PropagationStatus>> updated = userProvisioningManager.update(
- userPatch, before.getKey(),
+ userPatch,
result,
enabled,
- Collections.singleton(profile.getTask().getResource().getKey()));
+ Collections.singleton(profile.getTask().getResource().getKey()),
+ true);
return getAnyTO(updated.getKey());
}
@@ -119,8 +120,8 @@ public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler impleme
@Override
protected void doDelete(final AnyTypeKind kind, final Long key) {
try {
- userProvisioningManager.
- delete(key, Collections.<String>singleton(profile.getTask().getResource().getKey()));
+ userProvisioningManager.delete(
+ key, Collections.<String>singleton(profile.getTask().getResource().getKey()), true);
} catch (Exception e) {
// A propagation failure doesn't imply a synchronization failure.
// The propagation exception status will be reported into the propagation task execution.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/resources/provisioning.properties
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioning.properties b/core/provisioning-java/src/main/resources/provisioning.properties
index 55f9ead..b7e405d 100644
--- a/core/provisioning-java/src/main/resources/provisioning.properties
+++ b/core/provisioning-java/src/main/resources/provisioning.properties
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
asyncConnectorFacadeExecutor.poolSize=10
+
+# see http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#scheduling-task-namespace-executor
+propagationTaskExecutorAsyncExecutor.poolSize=5-25
+propagationTaskExecutorAsyncExecutor.queueCapacity=100
propagationTaskExecutor=org.apache.syncope.core.provisioning.java.propagation.PriorityPropagationTaskExecutor
userProvisioningManager=org.apache.syncope.core.provisioning.java.DefaultUserProvisioningManager
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/provisioning-java/src/main/resources/provisioningContext.xml
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/resources/provisioningContext.xml b/core/provisioning-java/src/main/resources/provisioningContext.xml
index 7fcafc7..333f202 100644
--- a/core/provisioning-java/src/main/resources/provisioningContext.xml
+++ b/core/provisioning-java/src/main/resources/provisioningContext.xml
@@ -32,8 +32,14 @@ under the License.
<!-- Used by AsyncConnectorFacade -->
<task:annotation-driven executor="AsyncConnectorFacadeExecutor"/>
- <task:executor id="AsyncConnectorFacadeExecutor" pool-size="${asyncConnectorFacadeExecutor.poolSize}"/>
-
+ <task:executor id="AsyncConnectorFacadeExecutor"
+ pool-size="${asyncConnectorFacadeExecutor.poolSize}"/>
+
+ <!-- Used by PriorityPropagationTaskExecutor -->
+ <task:executor id="propagationTaskExecutorAsyncExecutor"
+ pool-size="${propagationTaskExecutorAsyncExecutor.poolSize}"
+ queue-capacity="${propagationTaskExecutorAsyncExecutor.queueCapacity}"
+ rejection-policy="ABORT"/>
<bean class="${propagationTaskExecutor}"/>
<bean class="${userProvisioningManager}"/>
@@ -60,7 +66,7 @@ under the License.
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
- lazy-init="false" depends-on="quartzDataSourceInit">
+ lazy-init="false" depends-on="quartzDataSourceInit">
<property name="autoStartup" value="true"/>
<property name="applicationContextSchedulerContextKey" value="applicationContext"/>
<property name="waitForJobsToCompleteOnShutdown" value="true"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/AddETagFilter.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/AddETagFilter.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/AddETagFilter.java
index 31c4d69..1558267 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/AddETagFilter.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/AddETagFilter.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.ext.Provider;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.to.AbstractAnnotatedBean;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
/**
* Adds the <tt>ETag</tt> header to any response containing an instance of {@link AbstractAnnotatedBean} as entity.
@@ -37,11 +38,18 @@ public class AddETagFilter implements ContainerResponseFilter {
@Override
public void filter(final ContainerRequestContext reqCtx, final ContainerResponseContext resCtx) throws IOException {
- if (resCtx.getEntity() instanceof AbstractAnnotatedBean && resCtx.getEntityTag() == null) {
- AbstractAnnotatedBean sysInfo = (AbstractAnnotatedBean) resCtx.getEntity();
- String etagValue = sysInfo.getETagValue();
- if (StringUtils.isNotBlank(etagValue)) {
- resCtx.getHeaders().add(HttpHeaders.ETAG, new EntityTag(etagValue).toString());
+ if (resCtx.getEntityTag() == null) {
+ AbstractAnnotatedBean annotated = null;
+ if (resCtx.getEntity() instanceof AbstractAnnotatedBean) {
+ annotated = (AbstractAnnotatedBean) resCtx.getEntity();
+ } else if (resCtx.getEntity() instanceof ProvisioningResult) {
+ annotated = ((ProvisioningResult<?>) resCtx.getEntity()).getAny();
+ }
+ if (annotated != null) {
+ String etagValue = annotated.getETagValue();
+ if (StringUtils.isNotBlank(etagValue)) {
+ resCtx.getHeaders().add(HttpHeaders.ETAG, new EntityTag(etagValue).toString());
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
index 4258e64..97f2876 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractAnyService.java
@@ -36,6 +36,7 @@ import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.PatchOperation;
import org.apache.syncope.common.lib.types.ResourceAssociationAction;
import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
@@ -156,8 +157,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
@Override
public Response create(final TO anyTO) {
- TO created = getAnyLogic().create(anyTO);
- return createResponse(created.getKey(), created);
+ ProvisioningResult<TO> created = getAnyLogic().create(anyTO, isNullPriorityAsync());
+ return createResponse(created);
}
@Override
@@ -166,7 +167,7 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
checkETag(any.getETagValue());
- TO updated = getAnyLogic().update(anyPatch);
+ ProvisioningResult<TO> updated = getAnyLogic().update(anyPatch, isNullPriorityAsync());
return modificationResponse(updated);
}
@@ -197,7 +198,6 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
}
@Override
- @SuppressWarnings("unchecked")
public Response update(final Long key, final SchemaType schemaType, final AttrTO attrTO) {
addUpdateOrReplaceAttr(key, schemaType, attrTO, PatchOperation.ADD_REPLACE);
return modificationResponse(read(key, schemaType, attrTO.getSchema()));
@@ -209,8 +209,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
checkETag(before.getETagValue());
- @SuppressWarnings("unchecked")
- TO updated = getAnyLogic().update((P) AnyOperations.diff(anyTO, before, false));
+ ProvisioningResult<TO> updated =
+ getAnyLogic().update(AnyOperations.<TO, P>diff(anyTO, before, false), isNullPriorityAsync());
return modificationResponse(updated);
}
@@ -225,7 +225,7 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
checkETag(group.getETagValue());
- TO deleted = getAnyLogic().delete(key);
+ ProvisioningResult<TO> deleted = getAnyLogic().delete(key, isNullPriorityAsync());
return modificationResponse(deleted);
}
@@ -235,22 +235,24 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
checkETag(any.getETagValue());
- TO updated;
+ ProvisioningResult<TO> updated;
switch (patch.getAction()) {
case UNLINK:
- updated = getAnyLogic().unlink(patch.getKey(), patch.getResources());
+ updated = new ProvisioningResult<>();
+ updated.setAny(getAnyLogic().unlink(patch.getKey(), patch.getResources()));
break;
case UNASSIGN:
- updated = getAnyLogic().unassign(patch.getKey(), patch.getResources());
+ updated = getAnyLogic().unassign(patch.getKey(), patch.getResources(), isNullPriorityAsync());
break;
case DEPROVISION:
- updated = getAnyLogic().deprovision(patch.getKey(), patch.getResources());
+ updated = getAnyLogic().deprovision(patch.getKey(), patch.getResources(), isNullPriorityAsync());
break;
default:
- updated = getAnyLogic().read(patch.getKey());
+ updated = new ProvisioningResult<>();
+ updated.setAny(getAnyLogic().read(patch.getKey()));
}
BulkActionResult result = new BulkActionResult();
@@ -258,12 +260,12 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
if (patch.getAction() == ResourceDeassociationAction.UNLINK) {
for (String resource : patch.getResources()) {
result.getResults().put(resource,
- updated.getResources().contains(resource)
+ updated.getAny().getResources().contains(resource)
? BulkActionResult.Status.FAILURE
: BulkActionResult.Status.SUCCESS);
}
} else {
- for (PropagationStatus propagationStatusTO : updated.getPropagationStatusTOs()) {
+ for (PropagationStatus propagationStatusTO : updated.getPropagationStatuses()) {
result.getResults().put(propagationStatusTO.getResource(),
BulkActionResult.Status.valueOf(propagationStatusTO.getStatus().toString()));
}
@@ -278,12 +280,13 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
checkETag(any.getETagValue());
- TO updated;
+ ProvisioningResult<TO> updated;
switch (patch.getAction()) {
case LINK:
- updated = getAnyLogic().link(
+ updated = new ProvisioningResult<>();
+ updated.setAny(getAnyLogic().link(
patch.getKey(),
- patch.getResources());
+ patch.getResources()));
break;
case ASSIGN:
@@ -291,7 +294,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
patch.getKey(),
patch.getResources(),
patch.getValue() != null,
- patch.getValue());
+ patch.getValue(),
+ isNullPriorityAsync());
break;
case PROVISION:
@@ -299,11 +303,13 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
patch.getKey(),
patch.getResources(),
patch.getValue() != null,
- patch.getValue());
+ patch.getValue(),
+ isNullPriorityAsync());
break;
default:
- updated = getAnyLogic().read(patch.getKey());
+ updated = new ProvisioningResult<>();
+ updated.setAny(getAnyLogic().read(patch.getKey()));
}
BulkActionResult result = new BulkActionResult();
@@ -311,12 +317,12 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
if (patch.getAction() == ResourceAssociationAction.LINK) {
for (String resource : patch.getResources()) {
result.getResults().put(resource,
- updated.getResources().contains(resource)
+ updated.getAny().getResources().contains(resource)
? BulkActionResult.Status.FAILURE
: BulkActionResult.Status.SUCCESS);
}
} else {
- for (PropagationStatus propagationStatusTO : updated.getPropagationStatusTOs()) {
+ for (PropagationStatus propagationStatusTO : updated.getPropagationStatuses()) {
result.getResults().put(propagationStatusTO.getResource(),
BulkActionResult.Status.valueOf(propagationStatusTO.getStatus().toString()));
}
@@ -336,7 +342,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
for (String key : bulkAction.getTargets()) {
try {
result.getResults().put(
- String.valueOf(logic.delete(Long.valueOf(key)).getKey()),
+ String.valueOf(logic.delete(Long.valueOf(key), isNullPriorityAsync()).
+ getAny().getKey()),
BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing delete for user {}", key, e);
@@ -353,7 +360,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
statusPatch.setType(StatusPatchType.SUSPEND);
try {
result.getResults().put(
- String.valueOf(((UserLogic) logic).status(statusPatch).getKey()),
+ String.valueOf(((UserLogic) logic).
+ status(statusPatch, isNullPriorityAsync()).getAny().getKey()),
BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing suspend for user {}", key, e);
@@ -370,7 +378,8 @@ public abstract class AbstractAnyService<TO extends AnyTO, P extends AnyPatch>
statusPatch.setType(StatusPatchType.REACTIVATE);
try {
result.getResults().put(
- String.valueOf(((UserLogic) logic).status(statusPatch).getKey()),
+ String.valueOf(((UserLogic) logic).
+ status(statusPatch, isNullPriorityAsync()).getAny().getKey()),
BulkActionResult.Status.SUCCESS);
} catch (Exception e) {
LOG.error("Error performing reactivate for user {}", key, e);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
index 9265bcb..85f035f 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractServiceImpl.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.jaxrs.ext.search.SearchBean;
@@ -36,6 +37,7 @@ import org.apache.cxf.jaxrs.ext.search.SearchContext;
import org.apache.syncope.common.lib.AbstractBaseBean;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.rest.api.service.JAXRSService;
import org.apache.syncope.common.rest.api.Preference;
@@ -61,27 +63,31 @@ abstract class AbstractServiceImpl implements JAXRSService {
@Context
protected SearchContext searchContext;
+ protected boolean isNullPriorityAsync() {
+ return BooleanUtils.toBoolean(messageContext.getHttpHeaders().getHeaderString(RESTHeaders.NULL_PRIORITY_ASYNC));
+ }
+
/**
- * Reads <tt>Prefer</tt> header from request and parses into a <tt>Preference</tt> instance.
+ * Reads {@code Prefer} header from request and parses into a {@code Preference} instance.
*
- * @return a <tt>Preference</tt> instance matching the passed <tt>Prefer</tt> header,
- * or <tt>Preference.NONE</tt> if missing.
+ * @return a {@code Preference} instance matching the passed {@code Prefer} header,
+ * or {@code Preference.NONE} if missing.
*/
protected Preference getPreference() {
return Preference.fromString(messageContext.getHttpHeaders().getHeaderString(RESTHeaders.PREFER));
}
/**
- * Builds response to successful <tt>create</tt> request, taking into account any <tt>Prefer</tt> header.
+ * Builds response to successful {@code create} request, taking into account any {@code Prefer} header.
*
- * @param id identifier of the created entity
- * @param entity the entity just created
- * @return response to successful <tt>create</tt> request
+ * @param provisioningResult the entity just created
+ * @return response to successful {@code create} request
*/
- protected Response createResponse(final Object id, final Object entity) {
+ protected Response createResponse(final ProvisioningResult<?> provisioningResult) {
+ String entityId = String.valueOf(provisioningResult.getAny().getKey());
Response.ResponseBuilder builder = Response.
- created(uriInfo.getAbsolutePathBuilder().path(String.valueOf(id)).build()).
- header(RESTHeaders.RESOURCE_KEY, id);
+ created(uriInfo.getAbsolutePathBuilder().path(entityId).build()).
+ header(RESTHeaders.RESOURCE_KEY, entityId);
switch (getPreference()) {
case RETURN_NO_CONTENT:
@@ -90,7 +96,7 @@ abstract class AbstractServiceImpl implements JAXRSService {
case RETURN_CONTENT:
case NONE:
default:
- builder = builder.entity(entity);
+ builder = builder.entity(provisioningResult);
break;
}
@@ -102,7 +108,7 @@ abstract class AbstractServiceImpl implements JAXRSService {
}
/**
- * Builds response to successful modification request, taking into account any <tt>Prefer</tt> header.
+ * Builds response to successful modification request, taking into account any {@code Prefer} header.
*
* @param entity the entity just modified
* @return response to successful modification request
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
index 39dbba9..a7e88d3 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
@@ -148,11 +148,11 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
try {
switch (patch.getAction()) {
case DEPROVISION:
- associator.deprovision(anyKey, resources);
+ associator.deprovision(anyKey, resources, isNullPriorityAsync());
break;
case UNASSIGN:
- associator.unassign(anyKey, resources);
+ associator.unassign(anyKey, resources, isNullPriorityAsync());
break;
case UNLINK:
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
index ea69e69..3ccfd82 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.AnyOperations;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.patch.UserPatch;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -49,8 +50,8 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
throw sce;
}
- UserTO created = logic.selfCreate(userTO, storePassword);
- return createResponse(created.getKey(), created);
+ ProvisioningResult<UserTO> created = logic.selfCreate(userTO, storePassword, isNullPriorityAsync());
+ return createResponse(created);
}
@Override
@@ -65,7 +66,7 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
@Override
public Response update(final UserPatch patch) {
- UserTO updated = logic.selfUpdate(patch);
+ ProvisioningResult<UserTO> updated = logic.selfUpdate(patch, isNullPriorityAsync());
return modificationResponse(updated);
}
@@ -77,13 +78,13 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
@Override
public Response delete() {
- UserTO deleted = logic.selfDelete();
+ ProvisioningResult<UserTO> deleted = logic.selfDelete(isNullPriorityAsync());
return modificationResponse(deleted);
}
@Override
public Response changePassword(final String password) {
- UserTO updated = logic.changePassword(password);
+ ProvisioningResult<UserTO> updated = logic.changePassword(password, isNullPriorityAsync());
return modificationResponse(updated);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
index 7be0f29..0f62925 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserServiceImpl.java
@@ -22,6 +22,7 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.patch.StatusPatch;
import org.apache.syncope.common.lib.patch.UserPatch;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.UserService;
@@ -64,8 +65,8 @@ public class UserServiceImpl extends AbstractAnyService<UserTO, UserPatch> imple
@Override
public Response create(final UserTO userTO, final boolean storePassword) {
- UserTO created = logic.create(userTO, storePassword);
- return createResponse(created.getKey(), created);
+ ProvisioningResult<UserTO> created = logic.create(userTO, storePassword, isNullPriorityAsync());
+ return createResponse(created);
}
@Override
@@ -74,7 +75,7 @@ public class UserServiceImpl extends AbstractAnyService<UserTO, UserPatch> imple
checkETag(user.getETagValue());
- UserTO updated = logic.status(statusPatch);
+ ProvisioningResult<UserTO> updated = logic.status(statusPatch, isNullPriorityAsync());
return modificationResponse(updated);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelAnyObjectProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelAnyObjectProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelAnyObjectProvisioningManager.java
index 4ba890a..3e2f9f8 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelAnyObjectProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelAnyObjectProvisioningManager.java
@@ -36,19 +36,20 @@ public class CamelAnyObjectProvisioningManager
extends AbstractCamelProvisioningManager implements AnyObjectProvisioningManager {
@Override
- public Pair<Long, List<PropagationStatus>> create(final AnyObjectTO any) {
- return create(any, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(final AnyObjectTO any, final boolean nullPriorityAsync) {
+ return create(any, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
public Pair<Long, List<PropagationStatus>> create(
- final AnyObjectTO anyObjectTO, final Set<String> excludedResources) {
+ final AnyObjectTO anyObjectTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:createAnyObjectPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:createAnyObject", anyObjectTO, props);
@@ -62,19 +63,20 @@ public class CamelAnyObjectProvisioningManager
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final AnyObjectPatch anyPatch) {
- return update(anyPatch, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> update(final AnyObjectPatch anyPatch, final boolean nullPriorityAsync) {
+ return update(anyPatch, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
public Pair<Long, List<PropagationStatus>> update(
- final AnyObjectPatch anyPatch, final Set<String> excludedResources) {
+ final AnyObjectPatch anyPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:updateAnyObjectPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:updateAnyObject", anyPatch, props);
@@ -88,19 +90,22 @@ public class CamelAnyObjectProvisioningManager
}
@Override
- public List<PropagationStatus> delete(final Long anyObjectObjectKey) {
- return delete(anyObjectObjectKey, Collections.<String>emptySet());
+ public List<PropagationStatus> delete(final Long anyObjectObjectKey, final boolean nullPriorityAsync) {
+ return delete(anyObjectObjectKey, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> delete(final Long anyObjectKey, final Set<String> excludedResources) {
+ public List<PropagationStatus> delete(
+ final Long key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:deleteAnyObjectPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
- sendMessage("direct:deleteAnyObject", anyObjectKey, props);
+ sendMessage("direct:deleteAnyObject", key, props);
Exchange exchange = pollingConsumer.receive();
@@ -143,11 +148,14 @@ public class CamelAnyObjectProvisioningManager
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> provision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> provision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:provisionAnyObjectPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:provisionAnyObject", key, props);
@@ -162,13 +170,16 @@ public class CamelAnyObjectProvisioningManager
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> deprovision(final Long anyObjectKey, final Collection<String> resources) {
+ public List<PropagationStatus> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:deprovisionAnyObjectPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
- sendMessage("direct:deprovisionAnyObject", anyObjectKey, props);
+ sendMessage("direct:deprovisionAnyObject", key, props);
Exchange exchange = pollingConsumer.receive();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
index ea022bb..7cdf9d1 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
@@ -36,17 +36,20 @@ public class CamelGroupProvisioningManager
extends AbstractCamelProvisioningManager implements GroupProvisioningManager {
@Override
- public Pair<Long, List<PropagationStatus>> create(final GroupTO any) {
- return create(any, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(final GroupTO any, final boolean nullPriorityAsync) {
+ return create(any, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(
+ final GroupTO groupTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:createGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:createGroup", groupTO, props);
@@ -61,14 +64,18 @@ public class CamelGroupProvisioningManager
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> create(final GroupTO groupTO, final Map<Long, String> groupOwnerMap,
- final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(
+ final GroupTO groupTO,
+ final Map<Long, String> groupOwnerMap,
+ final Set<String> excludedResources,
+ final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:createGroupInSyncPort");
Map<String, Object> props = new HashMap<>();
props.put("groupOwnerMap", groupOwnerMap);
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:createGroupInSync", groupTO, props);
@@ -82,19 +89,20 @@ public class CamelGroupProvisioningManager
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final GroupPatch anyPatch) {
- return update(anyPatch, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> update(final GroupPatch anyPatch, final boolean nullPriorityAsync) {
+ return update(anyPatch, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
public Pair<Long, List<PropagationStatus>> update(
- final GroupPatch anyPatch, final Set<String> excludedResources) {
+ final GroupPatch anyPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:updateGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:updateGroup", anyPatch, props);
@@ -108,19 +116,22 @@ public class CamelGroupProvisioningManager
}
@Override
- public List<PropagationStatus> delete(final Long groupObjectKey) {
- return delete(groupObjectKey, Collections.<String>emptySet());
+ public List<PropagationStatus> delete(final Long key, final boolean nullPriorityAsync) {
+ return delete(key, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> delete(final Long groupKey, final Set<String> excludedResources) {
+ public List<PropagationStatus> delete(
+ final Long key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:deleteGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
- sendMessage("direct:deleteGroup", groupKey, props);
+ sendMessage("direct:deleteGroup", key, props);
Exchange exchange = pollingConsumer.receive();
@@ -163,11 +174,14 @@ public class CamelGroupProvisioningManager
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> provision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> provision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:provisionGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:provisionGroup", key, props);
@@ -182,11 +196,14 @@ public class CamelGroupProvisioningManager
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> deprovision(final Long key, final Collection<String> resources) {
+ public List<PropagationStatus> deprovision(
+ final Long key, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:deprovisionGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:deprovisionGroup", key, props);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
index 436d80d..1a918a5 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.sync.ProvisioningResult;
+import org.apache.syncope.core.provisioning.api.sync.ProvisioningReport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,24 +45,33 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
private static final Logger LOG = LoggerFactory.getLogger(CamelUserProvisioningManager.class);
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO) {
- return create(userTO, true, false, null, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean nullPriorityAsync) {
+ return create(userTO, true, false, null, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword) {
- return create(userTO, storePassword, false, null, Collections.<String>emptySet());
+ public Pair<Long, List<PropagationStatus>> create(
+ final UserTO userTO, final boolean storePassword, final boolean nullPriorityAsync) {
+
+ return create(userTO, storePassword, false, null, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final Set<String> excludedResources) {
- return create(userTO, false, false, null, excludedResources);
+ public Pair<Long, List<PropagationStatus>> create(
+ final UserTO userTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
+ return create(userTO, false, false, null, excludedResources, nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword,
- final boolean disablePwdPolicyCheck, final Boolean enabled, final Set<String> excludedResources) {
+ public Pair<Long, List<PropagationStatus>> create(
+ final UserTO userTO,
+ final boolean storePassword,
+ final boolean disablePwdPolicyCheck,
+ final Boolean enabled,
+ final Set<String> excludedResources,
+ final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:createPort");
@@ -71,6 +80,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
props.put("disablePwdPolicyCheck", disablePwdPolicyCheck);
props.put("enabled", enabled);
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:createUser", userTO, props);
@@ -85,10 +95,13 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> update(final UserPatch userPatch) {
+ public Pair<Long, List<PropagationStatus>> update(final UserPatch userPatch, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:updatePort");
- sendMessage("direct:updateUser", userPatch);
+ Map<String, Object> props = new HashMap<>();
+ props.put("nullPriorityAsync", nullPriorityAsync);
+
+ sendMessage("direct:updateUser", userPatch, props);
Exchange exchange = pollingConsumer.receive();
@@ -100,24 +113,29 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
}
@Override
- public Pair<Long, List<PropagationStatus>> update(final UserPatch anyPatch, final Set<String> excludedResources) {
- return update(anyPatch, anyPatch.getKey(), new ProvisioningResult(), null, excludedResources);
+ public Pair<Long, List<PropagationStatus>> update(
+ final UserPatch anyPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
+ return update(anyPatch, new ProvisioningReport(), null, excludedResources, nullPriorityAsync);
}
@Override
- public List<PropagationStatus> delete(final Long userKey) {
- return delete(userKey, Collections.<String>emptySet());
+ public List<PropagationStatus> delete(final Long key, final boolean nullPriorityAsync) {
+ return delete(key, Collections.<String>emptySet(), nullPriorityAsync);
}
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> delete(final Long userKey, final Set<String> excludedResources) {
+ public List<PropagationStatus> delete(
+ final Long key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:deletePort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
- sendMessage("direct:deleteUser", userKey, props);
+ sendMessage("direct:deleteUser", key, props);
Exchange exchange = pollingConsumer.receive();
@@ -146,13 +164,16 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> activate(final StatusPatch statusPatch) {
+ public Pair<Long, List<PropagationStatus>> activate(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
props.put("token", statusPatch.getToken());
- props.put("userKey", statusPatch.getKey());
+ props.put("key", statusPatch.getKey());
props.put("statusPatch", statusPatch);
+ props.put("nullPriorityAsync", nullPriorityAsync);
if (statusPatch.isOnSyncope()) {
sendMessage("direct:activateUser", statusPatch.getKey(), props);
@@ -173,12 +194,15 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> reactivate(final StatusPatch statusPatch) {
+ public Pair<Long, List<PropagationStatus>> reactivate(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
- props.put("userKey", statusPatch.getKey());
+ props.put("key", statusPatch.getKey());
props.put("statusPatch", statusPatch);
+ props.put("nullPriorityAsync", nullPriorityAsync);
if (statusPatch.isOnSyncope()) {
sendMessage("direct:reactivateUser", statusPatch.getKey(), props);
@@ -199,12 +223,15 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public Pair<Long, List<PropagationStatus>> suspend(final StatusPatch statusPatch) {
+ public Pair<Long, List<PropagationStatus>> suspend(
+ final StatusPatch statusPatch, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
- props.put("userKey", statusPatch.getKey());
+ props.put("key", statusPatch.getKey());
props.put("statusPatch", statusPatch);
+ props.put("nullPriorityAsync", nullPriorityAsync);
if (statusPatch.isOnSyncope()) {
sendMessage("direct:suspendUser", statusPatch.getKey(), props);
@@ -242,7 +269,11 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
public List<PropagationStatus> provision(
- final Long key, final boolean changePwd, final String password, final Collection<String> resources) {
+ final Long key,
+ final boolean changePwd,
+ final String password,
+ final Collection<String> resources,
+ final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:provisionPort");
@@ -251,6 +282,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
props.put("changePwd", changePwd);
props.put("password", password);
props.put("resources", resources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:provisionUser", key, props);
@@ -265,11 +297,14 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
- public List<PropagationStatus> deprovision(final Long user, final Collection<String> resources) {
+ public List<PropagationStatus> deprovision(
+ final Long user, final Collection<String> resources, final boolean nullPriorityAsync) {
+
PollingConsumer pollingConsumer = getConsumer("direct:deprovisionPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:deprovisionUser", user, props);
@@ -285,16 +320,20 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
@Override
@SuppressWarnings("unchecked")
public Pair<Long, List<PropagationStatus>> update(
- final UserPatch userPatch, final Long key, final ProvisioningResult result,
- final Boolean enabled, final Set<String> excludedResources) {
+ final UserPatch userPatch,
+ final ProvisioningReport result,
+ final Boolean enabled,
+ final Set<String> excludedResources,
+ final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:updateInSyncPort");
Map<String, Object> props = new HashMap<>();
- props.put("userKey", key);
+ props.put("key", userPatch.getKey());
props.put("result", result);
props.put("enabled", enabled);
props.put("excludedResources", excludedResources);
+ props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:updateUserInSync", userPatch, props);
@@ -302,9 +341,10 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
Exception ex = (Exception) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
if (ex != null) {
- LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)", key, ex);
+ LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)",
+ nullPriorityAsync, ex);
- result.setStatus(ProvisioningResult.Status.FAILURE);
+ result.setStatus(ProvisioningReport.Status.FAILURE);
result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + ex.getMessage());
WorkflowResult<Pair<UserPatch, Boolean>> updated = new WorkflowResult<Pair<UserPatch, Boolean>>(
@@ -331,10 +371,10 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
}
@Override
- public void requestPasswordReset(final Long userKey) {
+ public void requestPasswordReset(final Long key) {
PollingConsumer pollingConsumer = getConsumer("direct:requestPwdResetPort");
- sendMessage("direct:requestPwdReset", userKey);
+ sendMessage("direct:requestPwdReset", key);
Exchange exchange = pollingConsumer.receive();
@@ -348,7 +388,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
PollingConsumer pollingConsumer = getConsumer("direct:confirmPwdResetPort");
Map<String, Object> props = new HashMap<>();
- props.put("userKey", key);
+ props.put("key", key);
props.put("token", token);
props.put("password", password);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectCreateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectCreateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectCreateProcessor.java
index 1013d07..443e6aa 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectCreateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectCreateProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AnyObjectCreateProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectCreateProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -54,6 +49,7 @@ public class AnyObjectCreateProcessor implements Processor {
WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
AnyObjectTO any = exchange.getProperty("any", AnyObjectTO.class);
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getCreateTasks(
AnyTypeKind.ANY_OBJECT,
@@ -63,12 +59,7 @@ public class AnyObjectCreateProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(created.getResult(), propagationReporter.getStatuses()));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeleteProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeleteProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeleteProcessor.java
index 7826053..189480b 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeleteProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeleteProcessor.java
@@ -25,21 +25,16 @@ import org.apache.camel.Processor;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
import org.apache.syncope.core.workflow.api.AnyObjectWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AnyObjectDeleteProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectDeleteProcessor.class);
-
@Autowired
protected AnyObjectWorkflowAdapter gwfAdapter;
@@ -54,6 +49,7 @@ public class AnyObjectDeleteProcessor implements Processor {
Long key = exchange.getIn().getBody(Long.class);
@SuppressWarnings("unchecked")
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getDeleteTasks(
AnyTypeKind.ANY_OBJECT,
@@ -62,12 +58,7 @@ public class AnyObjectDeleteProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.setProperty("statuses", propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeprovisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeprovisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeprovisionProcessor.java
index f08b578..5a6fe52 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeprovisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectDeprovisionProcessor.java
@@ -28,20 +28,15 @@ import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AnyObjectDeprovisionProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserDeprovisionProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -56,6 +51,7 @@ public class AnyObjectDeprovisionProcessor implements Processor {
public void process(final Exchange exchange) {
Long key = exchange.getIn().getBody(Long.class);
List<String> resources = exchange.getProperty("resources", List.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.DELETE, resources);
@@ -67,12 +63,7 @@ public class AnyObjectDeprovisionProcessor implements Processor {
CollectionUtils.removeAll(anyObjectDAO.findAllResourceNames(anyObjectDAO.authFind(key)), resources));
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectProvisionProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectProvisionProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectProvisionProcessor.java
index 8170d34..2a8a318 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectProvisionProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectProvisionProcessor.java
@@ -26,20 +26,15 @@ import org.apache.syncope.common.lib.types.PropagationByResource;
import org.apache.syncope.common.lib.types.ResourceOperation;
import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AnyObjectProvisionProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectProvisionProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -51,6 +46,7 @@ public class AnyObjectProvisionProcessor implements Processor {
public void process(final Exchange exchange) {
Long key = exchange.getIn().getBody(Long.class);
List<String> resources = exchange.getProperty("resources", List.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, resources);
@@ -65,12 +61,7 @@ public class AnyObjectProvisionProcessor implements Processor {
null);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(propagationReporter.getStatuses());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectUpdateProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectUpdateProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectUpdateProcessor.java
index 3f2b690..a33296d 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectUpdateProcessor.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/AnyObjectUpdateProcessor.java
@@ -29,20 +29,15 @@ import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
import org.apache.syncope.core.provisioning.api.VirAttrHandler;
import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AnyObjectUpdateProcessor implements Processor {
- private static final Logger LOG = LoggerFactory.getLogger(UserUpdateProcessor.class);
-
@Autowired
protected PropagationManager propagationManager;
@@ -58,6 +53,7 @@ public class AnyObjectUpdateProcessor implements Processor {
WorkflowResult<Long> updated = (WorkflowResult) exchange.getIn().getBody();
AnyObjectPatch anyObjectPatch = exchange.getProperty("anyPatch", AnyObjectPatch.class);
Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+ Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
List<PropagationTask> tasks = propagationManager.getUpdateTasks(
AnyTypeKind.ANY_OBJECT,
@@ -69,12 +65,7 @@ public class AnyObjectUpdateProcessor implements Processor {
excludedResources);
PropagationReporter propagationReporter =
ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
- try {
- taskExecutor.execute(tasks, propagationReporter);
- } catch (PropagationException e) {
- LOG.error("Error propagation primary resource", e);
- propagationReporter.onPrimaryResourceFailure(tasks);
- }
+ taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
exchange.getOut().setBody(new ImmutablePair<>(updated.getResult(), propagationReporter.getStatuses()));
}
[26/50] [abbrv] syncope git commit: message refactoring, SYNCOPE-158
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
index b64eef6..6a4bfec 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
@@ -19,18 +19,28 @@
package org.apache.syncope.client.cli.commands.logger;
import java.util.LinkedList;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class LoggerList extends AbstractLoggerCommand {
- public LoggerList() {
+ private static final String LIST_HELP_MESSAGE = "logger --list";
+
+ private final Input input;
+
+ public LoggerList(final Input input) {
+ this.input = input;
}
public void list() {
- try {
- loggerResultManager.fromList(new LinkedList<>(loggerSyncopeOperations.list()));
- } catch (final SyncopeClientException ex) {
- loggerResultManager.generic("Error: " + ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ loggerResultManager.fromList(new LinkedList<>(loggerSyncopeOperations.list()));
+ } catch (final SyncopeClientException ex) {
+ loggerResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ loggerResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
index 1192252..321e257 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
@@ -45,7 +45,7 @@ public class LoggerRead extends AbstractLoggerCommand {
if (ex.getMessage().startsWith("NotFound")) {
loggerResultManager.notFoundError("Logger", parameter);
} else {
- loggerResultManager.generic("Error: " + ex.getMessage());
+ loggerResultManager.genericError(ex.getMessage());
}
failed = true;
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
index a693aff..d6f759c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
@@ -57,5 +57,4 @@ public class LoggerResultManager extends CommonsResultManager {
}
tableBuilder.build().print();
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
index 9a45916..6f118e9 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
@@ -57,11 +57,13 @@ public class LoggerUpdate extends AbstractLoggerCommand {
input.firstParameter(),
CommandUtils.fromEnumToArray(LoggerLevel.class));
} else if ("Parameter syntax error!".equalsIgnoreCase(ex.getMessage())) {
- loggerResultManager.generic(ex.getMessage(), UPDATE_HELP_MESSAGE);
+ loggerResultManager.genericError(ex.getMessage());
+ loggerResultManager.genericError(UPDATE_HELP_MESSAGE);
} else if (ex.getMessage().startsWith("NotFound")) {
loggerResultManager.notFoundError("Logger", parameter);
} else {
- loggerResultManager.generic(ex.getMessage(), UPDATE_HELP_MESSAGE);
+ loggerResultManager.genericError(ex.getMessage());
+ loggerResultManager.genericError(UPDATE_HELP_MESSAGE);
}
failed = true;
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
index 83c8b9a..981b2aa 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
@@ -52,7 +52,8 @@ public class LoggerUpdateAll extends AbstractLoggerCommand {
input.firstParameter(),
CommandUtils.fromEnumToArray(LoggerLevel.class));
} else {
- loggerResultManager.generic(ex.getMessage(), UPDATE_ALL_HELP_MESSAGE);
+ loggerResultManager.genericError(ex.getMessage());
+ loggerResultManager.genericError(UPDATE_ALL_HELP_MESSAGE);
}
failed = true;
break;
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java
index d5197ac..ee0f77c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java
@@ -45,7 +45,7 @@ public class NotificationCommand extends AbstractCommand {
switch (Options.fromName(input.getOption())) {
case LIST:
- new NotificationList().list();
+ new NotificationList(input).list();
break;
case READ:
new NotificationRead(input).read();
@@ -105,5 +105,4 @@ public class NotificationCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
index 3b11a5a..4690d24 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.cli.commands.notification;
import javax.xml.ws.WebServiceException;
import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.view.Messages;
import org.apache.syncope.common.lib.SyncopeClientException;
public class NotificationDelete extends AbstractNotificationCommand {
@@ -43,7 +42,7 @@ public class NotificationDelete extends AbstractNotificationCommand {
if (ex.getMessage().startsWith("NotFound")) {
notificationResultManager.notFoundError("Notification", parameter);
} else {
- Messages.printMessage(ex.getMessage());
+ notificationResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
notificationResultManager.notBooleanDeletedError("notification", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
index 3df5d64..9341ae2 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
@@ -18,18 +18,31 @@
*/
package org.apache.syncope.client.cli.commands.notification;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.NotificationTO;
public class NotificationList extends AbstractNotificationCommand {
+ private static final String LIST_HELP_MESSAGE = "notification --list";
+
+ private final Input input;
+
+ public NotificationList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- for (final NotificationTO notificationTO : notificationSyncopeOperations.list()) {
- System.out.println(notificationTO);
+ if (input.parameterNumber() == 0) {
+ try {
+ for (final NotificationTO notificationTO : notificationSyncopeOperations.list()) {
+ System.out.println(notificationTO);
+ }
+ } catch (final SyncopeClientException ex) {
+ notificationResultManager.genericError(ex.getMessage());
}
- } catch (final SyncopeClientException ex) {
- notificationResultManager.generic(ex.getMessage());
+ } else {
+ notificationResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
index bd82663..d493fa5 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
@@ -43,7 +43,7 @@ public class NotificationRead extends AbstractNotificationCommand {
if (ex.getMessage().startsWith("NotFound")) {
notificationResultManager.notFoundError("Notification", parameter);
} else {
- notificationResultManager.generic(ex.getMessage());
+ notificationResultManager.genericError(ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
index 7c92d9d..f665113 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
@@ -107,5 +107,4 @@ public class PolicyCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
index 8f9ede3..5dde82b 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
@@ -39,13 +39,12 @@ public class PolicyDelete extends AbstractPolicyCommand {
policySyncopeOperations.delete(parameter);
policyResultManager.deletedMessage("Policy", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
- System.out.println("Error:");
if (ex.getMessage().startsWith("NotFound")) {
policyResultManager.notFoundError("Policy", parameter);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- policyResultManager.generic("You cannot delete policy " + parameter);
+ policyResultManager.genericError("You cannot delete policy " + parameter);
} else {
- policyResultManager.generic(ex.getMessage());
+ policyResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
policyResultManager.notBooleanDeletedError("policy", parameter);
@@ -55,5 +54,4 @@ public class PolicyDelete extends AbstractPolicyCommand {
policyResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
index 4b672d6..d23fa11 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
@@ -47,7 +47,7 @@ public class PolicyList extends AbstractPolicyCommand {
}
policyResultManager.fromList(policyType, policyTOs);
} catch (final SyncopeClientException ex) {
- policyResultManager.generic(ex.getMessage());
+ policyResultManager.genericError(ex.getMessage());
} catch (final IllegalArgumentException ex) {
policyResultManager.typeNotValidError(
"policy", input.firstParameter(), CommandUtils.fromEnumToArray(PolicyType.class));
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
index 25c9306..0a466e0 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
@@ -40,17 +40,17 @@ public class PolicyRead extends AbstractPolicyCommand {
for (final String parameter : input.getParameters()) {
try {
policyTOs.add(policySyncopeOperations.read(parameter));
- policyResultManager.fromRead(policyTOs);
} catch (final NumberFormatException ex) {
policyResultManager.notBooleanDeletedError("policy", parameter);
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
policyResultManager.notFoundError("Policy", parameter);
} else {
- policyResultManager.generic(ex.getMessage());
+ policyResultManager.genericError(ex.getMessage());
}
}
}
+ policyResultManager.fromRead(policyTOs);
} else {
policyResultManager.commandOptionError(READ_HELP_MESSAGE);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
index 4d48b8d..0259e30 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
@@ -45,7 +45,7 @@ public class QuestionCommand extends AbstractCommand {
switch (QuestionOptions.fromName(input.getOption())) {
case LIST:
- new QuestionList().list();
+ new QuestionList(input).list();
break;
case READ:
new QuestionRead(input).read();
@@ -104,5 +104,4 @@ public class QuestionCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
index d57ae5c..29cff9d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
@@ -42,7 +42,7 @@ public class QuestionDelete extends AbstractQuestionCommand {
if (ex.getMessage().startsWith("NotFound")) {
questionResultManager.notFoundError("Security question", parameter);
} else {
- questionResultManager.generic("Error: " + ex.getMessage());
+ questionResultManager.genericError(ex.getMessage());
}
break;
} catch (final NumberFormatException ex) {
@@ -53,5 +53,4 @@ public class QuestionDelete extends AbstractQuestionCommand {
questionResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
index 836554a..7d2e18d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
@@ -18,15 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.question;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class QuestionList extends AbstractQuestionCommand {
+ private static final String LIST_HELP_MESSAGE = "question --list";
+
+ private final Input input;
+
+ public QuestionList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- questionResultManager.toView(questionSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- questionResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ questionResultManager.toView(questionSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ questionResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ questionResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
index 5f96cd5..306f449 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
@@ -45,7 +45,7 @@ public class QuestionRead extends AbstractQuestionCommand {
if (ex.getMessage().startsWith("NotFound")) {
questionResultManager.notFoundError("Security question", parameter);
} else {
- questionResultManager.generic("Error: " + ex.getMessage());
+ questionResultManager.genericError(ex.getMessage());
}
break;
} catch (final NumberFormatException ex) {
@@ -57,5 +57,4 @@ public class QuestionRead extends AbstractQuestionCommand {
questionResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
index 238a576..8caced7 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
@@ -42,5 +42,4 @@ public class QuestionSyncopeOperations {
public SecurityQuestionTO readByUser(final String username) {
return securityQuestionService.readByUser(username);
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
index 6a32562..95b8ec4 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
@@ -40,7 +40,7 @@ public class RealmCommand extends AbstractCommand {
}
switch (Options.fromName(input.getOption())) {
case LIST:
- new RealmList().list();
+ new RealmList(input).list();
break;
case HELP:
System.out.println(HELP_MESSAGE);
@@ -92,5 +92,4 @@ public class RealmCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
index 5d4b902..51b5fe4 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
@@ -18,19 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.realm;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class RealmList extends AbstractRealmCommand {
- public RealmList() {
+ private static final String LIST_HELP_MESSAGE = "realm --list";
+
+ private final Input input;
+
+ public RealmList(final Input input) {
+ this.input = input;
}
public void list() {
- try {
- realmResultManager.toView(realmSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- realmResultManager.generic("Error: " + ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ realmResultManager.toView(realmSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ realmResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ realmResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
index e9d0b65..19af12f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
@@ -40,5 +40,4 @@ public class RealmSyncopeOperations {
}
return exists;
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
index 1d64bf1..ac67fcf 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
@@ -32,6 +32,7 @@ public class ReportCommand extends AbstractCommand {
+ " Options:\n"
+ " --help \n"
+ " --list \n"
+ + " --list-jobs \n"
+ " --read \n"
+ " Syntax: --read {REPORT-ID} {REPORT-ID} [...] \n"
+ " --delete \n"
@@ -54,10 +55,10 @@ public class ReportCommand extends AbstractCommand {
switch (Options.fromName(input.getOption())) {
case LIST:
- new ReportList().list();
+ new ReportList(input).list();
break;
case LIST_JOBS:
- new ReportListJobs().list();
+ new ReportListJobs(input).list();
break;
case READ:
new ReportRead(input).read();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
index aa2c5f8..52850bd 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDelete.java
@@ -42,9 +42,9 @@ public class ReportDelete extends AbstractReportCommand {
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- reportResultManager.generic("You cannot delete report " + parameter);
+ reportResultManager.genericError("You cannot delete report " + parameter);
} else {
- reportResultManager.generic(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
reportResultManager.numberFormatException("report", parameter);
@@ -54,5 +54,4 @@ public class ReportDelete extends AbstractReportCommand {
reportResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
index 86f31a2..3ae7bb7 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportDeleteExecution.java
@@ -34,10 +34,8 @@ public class ReportDeleteExecution extends AbstractReportCommand {
}
public void delete() {
-
if (input.parameterNumber() >= 1) {
for (final String parameter : input.getParameters()) {
-
try {
reportSyncopeOperations.deleteExecution(parameter);
reportResultManager.deletedMessage("Report execution", parameter);
@@ -45,9 +43,9 @@ public class ReportDeleteExecution extends AbstractReportCommand {
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- reportResultManager.generic("You cannot delete report " + parameter);
+ reportResultManager.genericError("You cannot delete report " + parameter);
} else {
- reportResultManager.generic(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
reportResultManager.numberFormatException("report", parameter);
@@ -57,5 +55,4 @@ public class ReportDeleteExecution extends AbstractReportCommand {
reportResultManager.commandOptionError(DELETE_EXECUTION_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
index 0641203..f8a4f6d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExecute.java
@@ -37,7 +37,6 @@ public class ReportExecute extends AbstractReportCommand {
public void execute() {
if (input.parameterNumber() == 1) {
-
try {
reportSyncopeOperations.execute(input.firstParameter());
final List<ReportExecTO> executionList
@@ -48,9 +47,9 @@ public class ReportExecute extends AbstractReportCommand {
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", input.firstParameter());
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- reportResultManager.generic("You cannot delete report " + input.firstParameter());
+ reportResultManager.genericError("You cannot delete report " + input.firstParameter());
} else {
- reportResultManager.generic(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
reportResultManager.numberFormatException("report", input.firstParameter());
@@ -59,5 +58,4 @@ public class ReportExecute extends AbstractReportCommand {
reportResultManager.commandOptionError(EXECUTE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
index ae79e57..e7aca1e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportExportExecution.java
@@ -55,34 +55,35 @@ public class ReportExportExecution extends AbstractReportCommand {
case XML:
final String xmlFinalName = "export_" + parameter + ".xml";
XMLUtils.createXMLFile(report, xmlFinalName);
- reportResultManager.generic(xmlFinalName + " successfully created");
+ reportResultManager.genericMessage(xmlFinalName + " successfully created");
break;
case CSV:
- reportResultManager.generic(format + " doesn't supported");
+ reportResultManager.genericError(format + " doesn't supported");
break;
case PDF:
- reportResultManager.generic(format + " doesn't supported");
+ reportResultManager.genericError(format + " doesn't supported");
break;
case HTML:
- reportResultManager.generic(format + " doesn't supported");
+ reportResultManager.genericError(format + " doesn't supported");
break;
case RTF:
- reportResultManager.generic(format + " doesn't supported");
+ reportResultManager.genericError(format + " doesn't supported");
break;
default:
- reportResultManager.generic(format + " doesn't supported");
+ reportResultManager.genericError(format + " doesn't supported");
break;
}
} catch (final WebServiceException | SyncopeClientException ex) {
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
} else {
- reportResultManager.generic(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
reportResultManager.numberFormatException("report", parameter);
} catch (IOException | ParserConfigurationException | SAXException | TransformerException e) {
- reportResultManager.generic(" - Error creating " + "export_" + parameter + " " + e.getMessage());
+ reportResultManager.genericError(
+ " - Error creating " + "export_" + parameter + " " + e.getMessage());
} catch (final IllegalArgumentException ex) {
reportResultManager.typeNotValidError(
"format", input.firstParameter(),
@@ -94,5 +95,4 @@ public class ReportExportExecution extends AbstractReportCommand {
reportResultManager.commandOptionError(EXPORT_EXECUTION_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
index 7fca5c0..abeaf4e 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportList.java
@@ -18,16 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.report;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class ReportList extends AbstractReportCommand {
+ private static final String LIST_HELP_MESSAGE = "report --list";
+
+ private final Input input;
+
+ public ReportList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- reportResultManager.fromValueToView(reportSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- reportResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ reportResultManager.fromValueToView(reportSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ reportResultManager.genericMessage(ex.getMessage());
+ }
+ } else {
+ reportResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
index 5b13cbf..2735f85 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportListJobs.java
@@ -18,18 +18,31 @@
*/
package org.apache.syncope.client.cli.commands.report;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.types.JobStatusType;
public class ReportListJobs extends AbstractReportCommand {
+ private static final String LIST_HELP_MESSAGE = "report --list-jobs";
+
+ private final Input input;
+
+ public ReportListJobs(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- for (final JobStatusType jobStatusType : JobStatusType.values()) {
- reportResultManager.printReportExecution(reportSyncopeOperations.listJobs(jobStatusType));
+ if (input.parameterNumber() == 0) {
+ try {
+ for (final JobStatusType jobStatusType : JobStatusType.values()) {
+ reportResultManager.printReportExecution(reportSyncopeOperations.listJobs(jobStatusType));
+ }
+ } catch (final SyncopeClientException ex) {
+ reportResultManager.genericError(ex.getMessage());
}
- } catch (final SyncopeClientException ex) {
- reportResultManager.generic(ex.getMessage());
+ } else {
+ reportResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
index 9a1ebc8..acd5da0 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportRead.java
@@ -47,7 +47,7 @@ public class ReportRead extends AbstractReportCommand {
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
} else {
- reportResultManager.generic(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
index 45d1c54..f7c9ec3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportReadExecution.java
@@ -43,11 +43,10 @@ public class ReportReadExecution extends AbstractReportCommand {
try {
reportExecTOs.add(reportSyncopeOperations.readExecution(parameter));
} catch (final WebServiceException | SyncopeClientException ex) {
- System.out.println("Error:");
if (ex.getMessage().startsWith("NotFound")) {
reportResultManager.notFoundError("Report", parameter);
} else {
- reportResultManager.generic(ex.getMessage());
+ reportResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
reportResultManager.numberFormatException("report", parameter);
@@ -58,5 +57,4 @@ public class ReportReadExecution extends AbstractReportCommand {
reportResultManager.commandOptionError(READ_EXECUTION_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
index 942fcd2..185cd99 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceCommand.java
@@ -45,7 +45,7 @@ public class ResourceCommand extends AbstractCommand {
switch (ResourceOptions.fromName(input.getOption())) {
case LIST:
- new ResourceList().list();
+ new ResourceList(input).list();
break;
case READ:
new ResourceRead(input).read();
@@ -105,5 +105,4 @@ public class ResourceCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
index 9068b7d..3b94ecb 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceDelete.java
@@ -43,7 +43,7 @@ public class ResourceDelete extends AbstractResourceCommand {
if (ex.getMessage().startsWith("NotFound")) {
resourceResultManager.notFoundError("Resource", parameter);
} else {
- resourceResultManager.generic(ex.getMessage());
+ resourceResultManager.genericError(ex.getMessage());
}
break;
}
@@ -52,5 +52,4 @@ public class ResourceDelete extends AbstractResourceCommand {
resourceResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
index 27f0d74..8b09536 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceList.java
@@ -18,15 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.resource;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class ResourceList extends AbstractResourceCommand {
+ private static final String LIST_HELP_MESSAGE = "resource --list";
+
+ private final Input input;
+
+ public ResourceList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- resourceResultManager.toView(resourceSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- resourceResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ resourceResultManager.toView(resourceSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ resourceResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ resourceResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
index 85cd669..8f8c874 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceRead.java
@@ -46,7 +46,7 @@ public class ResourceRead extends AbstractResourceCommand {
if (ex.getMessage().startsWith("NotFound")) {
resourceResultManager.notFoundError("Resource", parameter);
} else {
- resourceResultManager.generic(ex.getMessage());
+ resourceResultManager.genericError(ex.getMessage());
}
break;
}
@@ -56,5 +56,4 @@ public class ResourceRead extends AbstractResourceCommand {
resourceResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
index d598910..488f574 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/resource/ResourceResultManager.java
@@ -31,7 +31,6 @@ public class ResourceResultManager extends CommonsResultManager {
for (final ResourceTO resourceTO : resourceTOs) {
printResource(resourceTO);
}
- System.out.println("");
}
private void printResource(final ResourceTO resourceTO) {
@@ -90,5 +89,4 @@ public class ResourceResultManager extends CommonsResultManager {
System.out.println("");
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
index bb2f988..63c9f09 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleCommand.java
@@ -45,7 +45,7 @@ public class RoleCommand extends AbstractCommand {
switch (RoleOptions.fromName(input.getOption())) {
case LIST:
- new RoleList().list();
+ new RoleList(input).list();
break;
case READ:
new RoleRead(input).read();
@@ -105,5 +105,4 @@ public class RoleCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
index e47a40e..4691312 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleDelete.java
@@ -42,7 +42,7 @@ public class RoleDelete extends AbstractRoleCommand {
if (ex.getMessage().startsWith("NotFound")) {
roleResultManager.notFoundError("Role", parameter);
} else {
- roleResultManager.generic("Error: " + ex.getMessage());
+ roleResultManager.genericError(ex.getMessage());
}
break;
} catch (final NumberFormatException ex) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
index e87b1c2..53f7105 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleList.java
@@ -18,15 +18,28 @@
*/
package org.apache.syncope.client.cli.commands.role;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
public class RoleList extends AbstractRoleCommand {
+ private static final String LIST_HELP_MESSAGE = "role --list";
+
+ private final Input input;
+
+ public RoleList(final Input input) {
+ this.input = input;
+ }
+
public void list() {
- try {
- roleResultManager.toView(roleSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- roleResultManager.generic(ex.getMessage());
+ if (input.parameterNumber() == 0) {
+ try {
+ roleResultManager.toView(roleSyncopeOperations.list());
+ } catch (final SyncopeClientException ex) {
+ roleResultManager.genericError(ex.getMessage());
+ }
+ } else {
+ roleResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
index 2a0393f..021b65c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleRead.java
@@ -45,7 +45,7 @@ public class RoleRead extends AbstractRoleCommand {
if (ex.getMessage().startsWith("NotFound")) {
roleResultManager.notFoundError("Role", parameter);
} else {
- roleResultManager.generic("Error: " + ex.getMessage());
+ roleResultManager.genericError(ex.getMessage());
}
break;
} catch (final NumberFormatException ex) {
@@ -57,5 +57,4 @@ public class RoleRead extends AbstractRoleCommand {
roleResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
index c24c3e9..11c207d 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/role/RoleSyncopeOperations.java
@@ -38,5 +38,4 @@ public class RoleSyncopeOperations {
public void delete(final String roleId) {
roleService.delete(Long.valueOf(roleId));
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
index 193c79b..c0d3976 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaCommand.java
@@ -51,16 +51,16 @@ public class SchemaCommand extends AbstractCommand {
new SchemaList(input).list();
break;
case LIST_ALL:
- new SchemaListAll().listAll();
+ new SchemaListAll(input).listAll();
break;
case LIST_PLAIN:
- new SchemaListPlain().listPlain();
+ new SchemaListPlain(input).listPlain();
break;
case LIST_DERIVED:
- new SchemaListDerived().listDerived();
+ new SchemaListDerived(input).listDerived();
break;
case LIST_VIRTUAL:
- new SchemaListVirtual().listVirtual();
+ new SchemaListVirtual(input).listVirtual();
break;
case READ:
new SchemaRead(input).read();
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
index 0850e2f..d3d5314 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaDelete.java
@@ -48,9 +48,9 @@ public class SchemaDelete extends AbstractSchemaCommand {
if (ex.getMessage().startsWith("NotFound")) {
schemaResultManager.notFoundError("Schema", parameters[0]);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- schemaResultManager.generic("You cannot delete schema " + parameters[0]);
+ schemaResultManager.genericError("You cannot delete schema " + parameters[0]);
} else {
- schemaResultManager.generic(ex.getMessage());
+ schemaResultManager.genericError(ex.getMessage());
}
} catch (final IllegalArgumentException ex) {
schemaResultManager.typeNotValidError(
@@ -60,5 +60,4 @@ public class SchemaDelete extends AbstractSchemaCommand {
schemaResultManager.commandOptionError(DELETE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
index 404a487..cf41aa7 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaList.java
@@ -58,7 +58,7 @@ public class SchemaList extends AbstractSchemaCommand {
break;
}
} catch (final SyncopeClientException ex) {
- schemaResultManager.generic(ex.getMessage());
+ schemaResultManager.genericError(ex.getMessage());
} catch (final IllegalArgumentException ex) {
schemaResultManager.typeNotValidError(
"schema", input.firstParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
index 57d95a1..2c17a3a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListAll.java
@@ -20,36 +20,48 @@ package org.apache.syncope.client.cli.commands.schema;
import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
import org.apache.syncope.common.lib.types.SchemaType;
public class SchemaListAll extends AbstractSchemaCommand {
+ private static final String LIST_HELP_MESSAGE = "schema --list-all";
+
+ private final Input input;
+
+ public SchemaListAll(final Input input) {
+ this.input = input;
+ }
+
public void listAll() {
- try {
- for (final SchemaType schemaType : SchemaType.values()) {
- final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.list(schemaType)) {
- schemaTOs.add(schemaTO);
- }
- switch (schemaType) {
- case PLAIN:
- schemaResultManager.fromListPlain(schemaTOs);
- break;
- case DERIVED:
- schemaResultManager.fromListDerived(schemaTOs);
- break;
- case VIRTUAL:
- schemaResultManager.fromListVirtual(schemaTOs);
- break;
- default:
- break;
+ if (input.parameterNumber() == 0) {
+ try {
+ for (final SchemaType schemaType : SchemaType.values()) {
+ final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.list(schemaType)) {
+ schemaTOs.add(schemaTO);
+ }
+ switch (schemaType) {
+ case PLAIN:
+ schemaResultManager.fromListPlain(schemaTOs);
+ break;
+ case DERIVED:
+ schemaResultManager.fromListDerived(schemaTOs);
+ break;
+ case VIRTUAL:
+ schemaResultManager.fromListVirtual(schemaTOs);
+ break;
+ default:
+ break;
+ }
}
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ schemaResultManager.genericError(ex.getMessage());
}
- } catch (final SyncopeClientException | WebServiceException ex) {
- schemaResultManager.generic(ex.getMessage());
+ } else {
+ schemaResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
index ee90327..fa76684 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListDerived.java
@@ -20,20 +20,33 @@ package org.apache.syncope.client.cli.commands.schema;
import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
public class SchemaListDerived extends AbstractSchemaCommand {
+ private static final String LIST_HELP_MESSAGE = "schema --list-derived";
+
+ private final Input input;
+
+ public SchemaListDerived(final Input input) {
+ this.input = input;
+ }
+
public void listDerived() {
- try {
- final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listDerived()) {
- schemaTOs.add(schemaTO);
+ if (input.parameterNumber() == 0) {
+ try {
+ final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listDerived()) {
+ schemaTOs.add(schemaTO);
+ }
+ schemaResultManager.fromListDerived(schemaTOs);
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ schemaResultManager.genericError(ex.getMessage());
}
- schemaResultManager.fromListDerived(schemaTOs);
- } catch (final SyncopeClientException | WebServiceException ex) {
- schemaResultManager.generic(ex.getMessage());
+ } else {
+ schemaResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
index 6fa9ad6..746b856 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListPlain.java
@@ -20,20 +20,33 @@ package org.apache.syncope.client.cli.commands.schema;
import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
public class SchemaListPlain extends AbstractSchemaCommand {
+ private static final String LIST_HELP_MESSAGE = "schema --list-plain";
+
+ private final Input input;
+
+ public SchemaListPlain(final Input input) {
+ this.input = input;
+ }
+
public void listPlain() {
- try {
- final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listPlain()) {
- schemaTOs.add(schemaTO);
+ if (input.parameterNumber() == 0) {
+ try {
+ final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listPlain()) {
+ schemaTOs.add(schemaTO);
+ }
+ schemaResultManager.fromListPlain(schemaTOs);
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ schemaResultManager.genericError(ex.getMessage());
}
- schemaResultManager.fromListPlain(schemaTOs);
- } catch (final SyncopeClientException | WebServiceException ex) {
- schemaResultManager.generic(ex.getMessage());
+ } else {
+ schemaResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
index 74b5b6c..d7da8c8 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaListVirtual.java
@@ -20,20 +20,33 @@ package org.apache.syncope.client.cli.commands.schema;
import java.util.LinkedList;
import javax.xml.ws.WebServiceException;
+import org.apache.syncope.client.cli.Input;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
public class SchemaListVirtual extends AbstractSchemaCommand {
+ private static final String LIST_HELP_MESSAGE = "schema --list-virtual";
+
+ private final Input input;
+
+ public SchemaListVirtual(final Input input) {
+ this.input = input;
+ }
+
public void listVirtual() {
- try {
- final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
- for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listVirtual()) {
- schemaTOs.add(schemaTO);
+ if (input.parameterNumber() == 0) {
+ try {
+ final LinkedList<AbstractSchemaTO> schemaTOs = new LinkedList<>();
+ for (final AbstractSchemaTO schemaTO : schemaSyncopeOperations.listVirtual()) {
+ schemaTOs.add(schemaTO);
+ }
+ schemaResultManager.fromListVirtual(schemaTOs);
+ } catch (final SyncopeClientException | WebServiceException ex) {
+ schemaResultManager.genericError(ex.getMessage());
}
- schemaResultManager.fromListVirtual(schemaTOs);
- } catch (final SyncopeClientException | WebServiceException ex) {
- schemaResultManager.generic(ex.getMessage());
+ } else {
+ schemaResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
index d84444d..133a14c 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaRead.java
@@ -64,7 +64,7 @@ public class SchemaRead extends AbstractSchemaCommand {
if (ex.getMessage().startsWith("NotFound")) {
schemaResultManager.notFoundError("Schema", parameters[0]);
} else {
- schemaResultManager.generic(ex.getMessage());
+ schemaResultManager.genericError(ex.getMessage());
}
} catch (final IllegalArgumentException ex) {
schemaResultManager.typeNotValidError(
@@ -74,5 +74,4 @@ public class SchemaRead extends AbstractSchemaCommand {
schemaResultManager.commandOptionError(READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
index c40dda9..dd5a3ff 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java
@@ -100,5 +100,4 @@ public class WorkflowCommand extends AbstractCommand {
return options;
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
index 89443da..aa1d8a3 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDefinition.java
@@ -43,7 +43,7 @@ public class WorkflowExportDefinition extends AbstractWorkflowCommand {
if (ex.getMessage().startsWith("NotFound")) {
workflowResultManager.notFoundError("Workflow", input.firstParameter());
} else {
- workflowResultManager.generic(ex.getMessage());
+ workflowResultManager.genericError(ex.getMessage());
}
} catch (final IllegalArgumentException ex) {
workflowResultManager.typeNotValidError(
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
index f65bf2f..abc4c61 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowExportDiagram.java
@@ -48,18 +48,18 @@ public class WorkflowExportDiagram extends AbstractWorkflowCommand {
final FileOutputStream fos = new FileOutputStream("/tmp/diagram.png");
fos.write(diagram);
fos.close();
- workflowResultManager.generic("Diagram created: /tmp/diagram.png");
+ workflowResultManager.genericMessage("Diagram created: /tmp/diagram.png");
} catch (final SyncopeClientException | WebServiceException ex) {
if (ex.getMessage().startsWith("NotFound")) {
workflowResultManager.notFoundError("Workflow", input.firstParameter());
} else {
- workflowResultManager.generic(ex.getMessage());
+ workflowResultManager.genericError(ex.getMessage());
}
} catch (final IllegalArgumentException ex) {
workflowResultManager.typeNotValidError(
"workflow", input.firstParameter(), CommandUtils.fromEnumToArray(AnyTypeKind.class));
} catch (final IOException ex) {
-
+ workflowResultManager.genericError(ex.getMessage());
}
} else {
workflowResultManager.commandOptionError(EXPORT_HELP_MESSAGE);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
index 2add12d..173db43 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowSyncopeOperations.java
@@ -37,5 +37,4 @@ public class WorkflowSyncopeOperations {
public Response exportDefinition(final AnyTypeKind anyTypeKind) {
return workflowService.exportDefinition(anyTypeKind);
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
index a616692..f95d69f 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskCommand.java
@@ -59,10 +59,10 @@ public class TaskCommand extends AbstractCommand {
new TaskList(input).list();
break;
case LIST_RUNNING_JOBS:
- new TaskRunningJobs().list();
+ new TaskListRunningJobs(input).list();
break;
case LIST_SCHEDULED_JOBS:
- new TaskScheduledJobs().list();
+ new TaskListScheduledJobs(input).list();
break;
case READ:
new TaskRead(input).read();
@@ -85,7 +85,6 @@ public class TaskCommand extends AbstractCommand {
default:
new TaskResultManager().defaultError(input.getOption(), HELP_MESSAGE);
}
-
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
index e0d4753..c5089ff 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskDelete.java
@@ -43,9 +43,9 @@ public class TaskDelete extends AbstractTaskCommand {
if (ex.getMessage().startsWith("NotFound")) {
taskResultManager.notFoundError("Task", parameter);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- taskResultManager.generic("You cannot delete task " + parameter);
+ taskResultManager.genericError("You cannot delete task " + parameter);
} else {
- taskResultManager.generic(ex.getMessage());
+ taskResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
taskResultManager.notBooleanDeletedError("task", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
index dfefae3..a501905 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecute.java
@@ -51,9 +51,9 @@ public class TaskExecute extends AbstractTaskCommand {
if (ex.getMessage().startsWith("NotFound")) {
taskResultManager.notFoundError("Task", input.firstParameter());
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- taskResultManager.generic("You cannot delete task " + input.firstParameter());
+ taskResultManager.genericError("You cannot delete task " + input.firstParameter());
} else {
- taskResultManager.generic(ex.getMessage());
+ taskResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
taskResultManager.notBooleanDeletedError("task", input.firstParameter());
@@ -62,5 +62,4 @@ public class TaskExecute extends AbstractTaskCommand {
taskResultManager.commandOptionError(EXECUTE_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
index bb6d694..30cbf42 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionDelete.java
@@ -43,9 +43,9 @@ public class TaskExecutionDelete extends AbstractTaskCommand {
if (ex.getMessage().startsWith("NotFound")) {
taskResultManager.notFoundError("Task execution", parameter);
} else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- taskResultManager.generic("You cannot delete task execution" + parameter);
+ taskResultManager.genericError("You cannot delete task execution" + parameter);
} else {
- taskResultManager.generic(ex.getMessage());
+ taskResultManager.genericError(ex.getMessage());
}
} catch (final NumberFormatException ex) {
taskResultManager.notBooleanDeletedError("task execution", parameter);
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
index d83e2ef..c234028 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskExecutionRead.java
@@ -45,7 +45,7 @@ public class TaskExecutionRead extends AbstractTaskCommand {
if (ex.getMessage().startsWith("NotFound")) {
taskResultManager.notFoundError("Task execution", parameter);
} else {
- taskResultManager.generic("Error: " + ex.getMessage());
+ taskResultManager.genericError(ex.getMessage());
}
break;
}
@@ -54,5 +54,4 @@ public class TaskExecutionRead extends AbstractTaskCommand {
taskResultManager.commandOptionError(EXECUTION_READ_HELP_MESSAGE);
}
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/6d368c8b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
index b8c08e5..e01141a 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/task/TaskList.java
@@ -47,7 +47,7 @@ public class TaskList extends AbstractTaskCommand {
}
taskResultManager.fromList(taskType, taskTOs);
} catch (final SyncopeClientException ex) {
- taskResultManager.generic(ex.getMessage());
+ taskResultManager.genericError(ex.getMessage());
} catch (final IllegalArgumentException ex) {
taskResultManager.typeNotValidError(
"task", input.firstParameter(), CommandUtils.fromEnumToArray(TaskType.class));
[43/50] [abbrv] syncope git commit: merge from master
Posted by fm...@apache.org.
merge from master
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/77fc5d26
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/77fc5d26
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/77fc5d26
Branch: refs/heads/SYNCOPE-156
Commit: 77fc5d26b01f4b56fad131e5c6190103a161e77c
Parents: ee7ca34 714557e
Author: fmartelli <fa...@gmail.com>
Authored: Fri Oct 30 11:21:36 2015 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Oct 30 11:21:36 2015 +0100
----------------------------------------------------------------------
.travis.yml | 2 -
.../org/apache/syncope/client/cli/Input.java | 6 +
.../apache/syncope/client/cli/SyncopeAdm.java | 7 +-
.../cli/commands/CommonsResultManager.java | 15 +-
.../AbstractConfigurationCommand.java | 6 +-
.../configuration/ConfigurationCommand.java | 2 +-
.../configuration/ConfigurationDelete.java | 7 +-
.../configuration/ConfigurationExport.java | 14 +-
.../configuration/ConfigurationGet.java | 21 +-
.../configuration/ConfigurationRead.java | 5 +-
.../ConfigurationSyncopeOperations.java | 50 ++
.../configuration/ConfigurationUpdate.java | 11 +-
.../connector/AbstractConnectorCommand.java | 5 +-
.../commands/connector/ConnectorCommand.java | 4 +-
.../cli/commands/connector/ConnectorDelete.java | 9 +-
.../cli/commands/connector/ConnectorList.java | 21 +-
.../connector/ConnectorListBundles.java | 21 +-
.../ConnectorListConfigurationProperties.java | 12 +-
.../cli/commands/connector/ConnectorRead.java | 13 +-
.../connector/ConnectorReadByResource.java | 11 +-
.../connector/ConnectorResultManager.java | 42 +-
.../connector/ConnectorSyncopeOperations.java | 50 ++
.../commands/domain/AbstractDomainCommand.java | 5 +-
.../cli/commands/domain/DomainCommand.java | 4 +-
.../cli/commands/domain/DomainDelete.java | 7 +-
.../client/cli/commands/domain/DomainList.java | 22 +-
.../client/cli/commands/domain/DomainRead.java | 8 +-
.../commands/domain/DomainResultManager.java | 12 +
.../domain/DomainSyncopeOperations.java | 41 +
.../entitlement/AbstractEntitlementCommand.java | 27 +
.../entitlement/EntitlementCommand.java | 120 +++
.../commands/entitlement/EntitlementList.java | 40 +
.../entitlement/EntitlementListRole.java | 61 ++
.../entitlement/EntitlementReadByUserId.java | 53 ++
.../entitlement/EntitlementReadByUsername.java | 53 ++
.../entitlement/EntitlementResultManager.java | 53 ++
.../entitlement/EntitlementSearchByRole.java | 53 ++
.../EntitlementSyncopeOperations.java | 74 ++
.../syncope/client/cli/commands/help/Help.java | 6 +-
.../cli/commands/help/HelpResultManager.java | 3 +
.../syncope/client/cli/commands/info/Info.java | 133 ++-
.../cli/commands/info/InfoResultManager.java | 126 +++
.../cli/commands/install/InstallCommand.java | 13 +-
.../commands/install/InstallResultManager.java | 10 +
.../cli/commands/install/InstallSetup.java | 23 +-
.../commands/logger/AbstractLoggerCommand.java | 7 +-
.../cli/commands/logger/LoggerCommand.java | 3 +-
.../cli/commands/logger/LoggerCreate.java | 4 +-
.../cli/commands/logger/LoggerDelete.java | 6 +-
.../client/cli/commands/logger/LoggerList.java | 21 +-
.../client/cli/commands/logger/LoggerRead.java | 5 +-
.../commands/logger/LoggerResultManager.java | 1 -
.../logger/LoggerSyncopeOperations.java | 46 +
.../cli/commands/logger/LoggerUpdate.java | 11 +-
.../cli/commands/logger/LoggerUpdateAll.java | 8 +-
.../AbstractNotificationCommand.java | 5 +-
.../notification/NotificationCommand.java | 3 +-
.../notification/NotificationDelete.java | 5 +-
.../commands/notification/NotificationList.java | 23 +-
.../commands/notification/NotificationRead.java | 4 +-
.../NotificationSyncopeOperations.java | 41 +
.../commands/policy/AbstractPolicyCommand.java | 7 +-
.../cli/commands/policy/PolicyCommand.java | 1 -
.../cli/commands/policy/PolicyDelete.java | 8 +-
.../client/cli/commands/policy/PolicyList.java | 4 +-
.../client/cli/commands/policy/PolicyRead.java | 6 +-
.../policy/PolicySyncopeOperations.java | 42 +
.../question/AbstractQuestionCommand.java | 27 +
.../cli/commands/question/QuestionCommand.java | 107 +++
.../cli/commands/question/QuestionDelete.java | 56 ++
.../cli/commands/question/QuestionList.java | 45 +
.../cli/commands/question/QuestionRead.java | 60 ++
.../question/QuestionResultManager.java | 38 +
.../question/QuestionSyncopeOperations.java | 45 +
.../commands/realm/AbstractRealmCommand.java | 27 +
.../client/cli/commands/realm/RealmCommand.java | 95 +++
.../client/cli/commands/realm/RealmList.java | 45 +
.../cli/commands/realm/RealmResultManager.java | 39 +
.../commands/realm/RealmSyncopeOperations.java | 43 +
.../commands/report/AbstractReportCommand.java | 5 +-
.../cli/commands/report/ReportCommand.java | 5 +-
.../cli/commands/report/ReportDelete.java | 9 +-
.../commands/report/ReportDeleteExecution.java | 11 +-
.../cli/commands/report/ReportExecute.java | 13 +-
.../commands/report/ReportExportExecution.java | 28 +-
.../client/cli/commands/report/ReportList.java | 22 +-
.../cli/commands/report/ReportListJobs.java | 23 +-
.../client/cli/commands/report/ReportRead.java | 6 +-
.../commands/report/ReportReadExecution.java | 8 +-
.../report/ReportSyncopeOperations.java | 65 ++
.../resource/AbstractResourceCommand.java | 7 +-
.../cli/commands/resource/ResourceCommand.java | 3 +-
.../cli/commands/resource/ResourceDelete.java | 7 +-
.../cli/commands/resource/ResourceList.java | 21 +-
.../cli/commands/resource/ResourceRead.java | 7 +-
.../resource/ResourceResultManager.java | 7 +-
.../resource/ResourceSyncopeOperations.java | 51 ++
.../cli/commands/role/AbstractRoleCommand.java | 27 +
.../client/cli/commands/role/RoleCommand.java | 108 +++
.../client/cli/commands/role/RoleDelete.java | 57 ++
.../client/cli/commands/role/RoleList.java | 45 +
.../client/cli/commands/role/RoleRead.java | 60 ++
.../cli/commands/role/RoleResultManager.java | 57 ++
.../commands/role/RoleSyncopeOperations.java | 41 +
.../commands/schema/AbstractSchemaCommand.java | 7 +-
.../cli/commands/schema/SchemaCommand.java | 8 +-
.../cli/commands/schema/SchemaDelete.java | 7 +-
.../client/cli/commands/schema/SchemaList.java | 4 +-
.../cli/commands/schema/SchemaListAll.java | 54 +-
.../cli/commands/schema/SchemaListDerived.java | 28 +-
.../cli/commands/schema/SchemaListPlain.java | 28 +-
.../cli/commands/schema/SchemaListVirtual.java | 28 +-
.../client/cli/commands/schema/SchemaRead.java | 5 +-
.../schema/SchemaSyncopeOperations.java | 54 ++
.../commands/self/AbstractWorkflowCommand.java | 27 +
.../cli/commands/self/WorkflowCommand.java | 103 +++
.../commands/self/WorkflowExportDefinition.java | 56 ++
.../commands/self/WorkflowExportDiagram.java | 68 ++
.../commands/self/WorkflowResultManager.java | 38 +
.../self/WorkflowSyncopeOperations.java | 40 +
.../cli/commands/task/AbstractTaskCommand.java | 5 +-
.../client/cli/commands/task/TaskCommand.java | 5 +-
.../client/cli/commands/task/TaskDelete.java | 6 +-
.../client/cli/commands/task/TaskExecute.java | 9 +-
.../cli/commands/task/TaskExecutionDelete.java | 6 +-
.../cli/commands/task/TaskExecutionRead.java | 5 +-
.../client/cli/commands/task/TaskList.java | 4 +-
.../cli/commands/task/TaskListRunningJobs.java | 46 +
.../commands/task/TaskListScheduledJobs.java | 45 +
.../client/cli/commands/task/TaskRead.java | 5 +-
.../cli/commands/task/TaskResultManager.java | 2 +-
.../cli/commands/task/TaskRunningJobs.java | 34 -
.../cli/commands/task/TaskScheduledJobs.java | 34 -
.../commands/task/TaskSyncopeOperations.java | 66 ++
.../cli/commands/user/AbstractUserCommand.java | 27 +
.../client/cli/commands/user/UserCommand.java | 143 ++++
.../client/cli/commands/user/UserCount.java | 45 +
.../client/cli/commands/user/UserDelete.java | 55 ++
.../client/cli/commands/user/UserGetKey.java | 45 +
.../cli/commands/user/UserGetUsername.java | 45 +
.../client/cli/commands/user/UserList.java | 61 ++
.../client/cli/commands/user/UserRead.java | 60 ++
.../cli/commands/user/UserResultManager.java | 107 +++
.../commands/user/UserSearchByAttribute.java | 70 ++
.../cli/commands/user/UserSearchByResource.java | 69 ++
.../cli/commands/user/UserSearchByRole.java | 63 ++
.../commands/user/UserSyncopeOperations.java | 78 ++
.../syncope/client/cli/util/CommandUtils.java | 1 -
.../client/cli/util/FileSystemUtils.java | 9 +-
.../syncope/client/cli/util/JasyptUtils.java | 1 -
.../syncope/client/cli/view/Messages.java | 7 +-
.../console/pages/ProvisioningModalPage.java | 15 +-
.../syncope/client/console/pages/Realms.java | 2 -
.../syncope/client/console/panels/Realm.java | 2 -
.../client/console/panels/RealmModalPanel.java | 2 -
.../console/panels/ResourceConnConfPanel.java | 12 +-
.../console/panels/ResourceMappingPanel.java | 20 +-
.../console/rest/ConnectorRestClient.java | 59 +-
.../client/console/rest/LoggerRestClient.java | 4 +-
.../client/console/rest/ResourceRestClient.java | 12 +-
client/enduser/pom.xml | 194 +++++
.../enduser/SyncopeEnduserApplication.java | 157 ++++
.../client/enduser/SyncopeEnduserSession.java | 279 +++++++
.../client/enduser/adapters/UserTOAdapter.java | 78 ++
.../client/enduser/model/Credentials.java | 65 ++
.../client/enduser/model/SchemaResponse.java | 79 ++
.../client/enduser/model/UserTORequest.java | 174 ++++
.../syncope/client/enduser/pages/HomePage.java | 35 +
.../enduser/resources/AbstractBaseResource.java | 58 ++
.../client/enduser/resources/ErrorResource.java | 50 ++
.../client/enduser/resources/LoginResource.java | 84 ++
.../enduser/resources/LogoutResource.java | 43 +
.../enduser/resources/SchemaResource.java | 116 +++
.../resources/SecurityQuestionResource.java | 73 ++
.../resources/UserSelfCreateResource.java | 97 +++
.../enduser/resources/UserSelfReadResource.java | 66 ++
.../resources/UserSelfUpdateResource.java | 96 +++
.../META-INF/resources/app/css/app.css | 28 +
.../META-INF/resources/app/css/editUser.css | 253 ++++++
.../META-INF/resources/app/css/login.css | 103 +++
.../META-INF/resources/app/img/ajax-loader.gif | Bin 0 -> 1924 bytes
.../META-INF/resources/app/img/busy.gif | Bin 0 -> 2834 bytes
.../META-INF/resources/app/img/favicon.png | Bin 0 -> 641 bytes
.../META-INF/resources/app/img/logo-green.png | Bin 0 -> 12178 bytes
.../META-INF/resources/app/img/logo.png | Bin 0 -> 8913 bytes
.../resources/META-INF/resources/app/index.html | 116 +++
.../resources/META-INF/resources/app/js/app.js | 283 +++++++
.../app/js/controllers/HomeController.js | 39 +
.../app/js/controllers/LanguageController.js | 66 ++
.../app/js/controllers/LoginController.js | 93 +++
.../app/js/controllers/UserController.js | 206 +++++
.../app/js/directives/dynamicAttribute.js | 190 +++++
.../js/directives/dynamicDerivedAttributes.js | 52 ++
.../app/js/directives/dynamicPlainAttributes.js | 45 +
.../js/directives/dynamicVirtualAttributes.js | 52 ++
.../resources/app/js/directives/equals.js | 49 ++
.../resources/app/js/directives/loader.js | 32 +
.../app/js/directives/navigationButtons.js | 31 +
.../js/directives/passwordStrengthEstimator.js | 102 +++
.../resources/app/js/filters/propsFilter.js | 52 ++
.../resources/app/js/services/authService.js | 74 ++
.../resources/app/js/services/realmService.js | 47 ++
.../resources/app/js/services/schemaService.js | 42 +
.../app/js/services/securityQuestionService.js | 41 +
.../app/js/services/userSelfService.js | 69 ++
.../resources/app/views/dynamicAttribute.html | 58 ++
.../app/views/dynamicDerivedAttributes.html | 21 +
.../app/views/dynamicPlainAttributes.html | 22 +
.../app/views/dynamicVirtualAttributes.html | 18 +
.../META-INF/resources/app/views/editUser.html | 73 ++
.../resources/app/views/generic-error.html | 24 +
.../META-INF/resources/app/views/home.html | 34 +
.../resources/app/views/navigationButtons.html | 8 +
.../META-INF/resources/app/views/self.html | 131 +++
.../resources/app/views/user-credentials.html | 60 ++
.../app/views/user-derived-schemas.html | 37 +
.../resources/app/views/user-groups.html | 37 +
.../resources/app/views/user-plain-schemas.html | 37 +
.../resources/app/views/user-resources.html | 28 +
.../app/views/user-virtual-schemas.html | 37 +
.../main/resources/META-INF/web-fragment.xml | 72 ++
.../src/main/resources/enduser.properties | 30 +
.../syncope/client/enduser/pages/HomePage.html | 22 +
.../enduser/SyncopeEnduserApplicationTest.java | 69 ++
.../syncope/client/lib/SyncopeClient.java | 13 +
client/pom.xml | 1 +
.../syncope/common/lib/patch/PasswordPatch.java | 2 +-
.../lib/patch/ResourceDeassociationPatch.java | 80 ++
.../org/apache/syncope/common/lib/to/AnyTO.java | 9 -
.../common/lib/to/ConnIdObjectClassTO.java | 78 ++
.../syncope/common/lib/to/ConnInstanceTO.java | 38 +-
.../common/lib/to/PropagationStatus.java | 50 --
.../common/lib/to/PropagationTaskTO.java | 10 +-
.../common/lib/to/ProvisioningResult.java | 55 ++
.../syncope/common/lib/to/ResourceTO.java | 47 +-
.../syncope/common/lib/types/Entitlement.java | 14 +-
.../lib/types/PropagationTaskExecStatus.java | 3 +-
.../common/lib/wrap/AbstractWrappable.java | 46 -
.../apache/syncope/common/lib/wrap/AnyKey.java | 30 -
.../common/lib/wrap/ConnIdObjectClass.java | 30 -
.../syncope/common/lib/wrap/package-info.java | 23 -
.../common/rest/api/CollectionWrapper.java | 80 --
.../syncope/common/rest/api/LoggerWrapper.java | 56 ++
.../syncope/common/rest/api/RESTHeaders.java | 5 +
.../common/rest/api/service/AnyService.java | 8 +-
.../rest/api/service/ConnectorService.java | 43 +-
.../rest/api/service/ResourceService.java | 14 +-
.../rest/api/service/UserSelfService.java | 10 +-
.../common/rest/api/service/UserService.java | 4 +-
.../syncope/core/logic/AbstractAnyLogic.java | 44 +-
.../core/logic/AbstractResourceAssociator.java | 19 +-
.../syncope/core/logic/AnyObjectLogic.java | 69 +-
.../syncope/core/logic/AnyTypeClassLogic.java | 4 +-
.../apache/syncope/core/logic/AnyTypeLogic.java | 4 +-
.../syncope/core/logic/ConnectorLogic.java | 76 +-
.../apache/syncope/core/logic/GroupLogic.java | 68 +-
.../syncope/core/logic/ResourceLogic.java | 25 +-
.../apache/syncope/core/logic/SchemaLogic.java | 2 +-
.../apache/syncope/core/logic/UserLogic.java | 137 +--
.../notification/NotificationJobDelegate.java | 2 +-
.../core/logic/report/ReportJobDelegate.java | 2 +-
.../core/logic/report/StaticReportlet.java | 2 +-
.../core/logic/report/UserReportlet.java | 2 +-
.../syncope/core/misc/ConnObjectUtils.java | 259 ------
.../syncope/core/misc/ExceptionUtils2.java | 47 --
.../apache/syncope/core/misc/FormatUtils.java | 117 ---
.../apache/syncope/core/misc/MappingUtils.java | 800 ------------------
.../apache/syncope/core/misc/RealmUtils.java | 61 --
.../apache/syncope/core/misc/TemplateUtils.java | 223 -----
.../syncope/core/misc/jexl/JexlUtils.java | 2 +-
.../core/misc/security/AuthDataAccessor.java | 4 +-
.../misc/security/SyncopeGrantedAuthority.java | 2 +-
.../core/misc/utils/ConnObjectUtils.java | 259 ++++++
.../core/misc/utils/ExceptionUtils2.java | 47 ++
.../syncope/core/misc/utils/FormatUtils.java | 121 +++
.../syncope/core/misc/utils/MappingUtils.java | 831 +++++++++++++++++++
.../syncope/core/misc/utils/RealmUtils.java | 61 ++
.../syncope/core/misc/utils/TemplateUtils.java | 223 +++++
core/misc/src/main/resources/utilsContext.xml | 32 +
.../persistence/api/entity/ConnInstance.java | 41 +-
.../api/entity/resource/ExternalResource.java | 15 +-
.../api/entity/task/PropagationTask.java | 2 +
.../jpa/content/ContentLoaderHandler.java | 2 +-
.../jpa/content/XMLContentExporter.java | 2 +-
.../persistence/jpa/dao/JPAAnySearchDAO.java | 2 +-
.../core/persistence/jpa/dao/JPAGroupDAO.java | 2 +-
.../jpa/entity/AbstractPlainAttrValue.java | 2 +-
.../persistence/jpa/entity/JPAConnInstance.java | 33 +-
.../entity/resource/JPAExternalResource.java | 67 +-
.../jpa/entity/task/JPAPropagationTask.java | 17 +-
.../persistence/jpa/DummyConnectorRegistry.java | 13 +-
.../persistence/jpa/inner/ConnInstanceTest.java | 6 +-
.../persistence/jpa/inner/ResourceTest.java | 3 -
.../persistence/jpa/outer/ConnInstanceTest.java | 2 +-
.../test/resources/domains/MasterContent.xml | 102 +--
.../api/AnyObjectProvisioningManager.java | 2 +-
.../provisioning/api/ConnIdBundleManager.java | 2 +-
.../core/provisioning/api/Connector.java | 50 +-
.../core/provisioning/api/ConnectorFactory.java | 23 +-
.../provisioning/api/ConnectorRegistry.java | 12 -
.../api/GroupProvisioningManager.java | 4 +-
.../provisioning/api/ProvisioningManager.java | 14 +-
.../api/UserProvisioningManager.java | 30 +-
.../api/data/ConnInstanceDataBinder.java | 16 +-
.../api/data/ResourceDataBinder.java | 7 +-
.../api/propagation/PropagationReporter.java | 30 +-
.../propagation/PropagationTaskCallable.java | 32 +
.../propagation/PropagationTaskExecutor.java | 21 +-
.../api/sync/ProvisioningProfile.java | 4 +-
.../api/sync/ProvisioningReport.java | 140 ++++
.../api/sync/ProvisioningResult.java | 140 ----
.../core/provisioning/api/sync/PushActions.java | 4 +-
.../core/provisioning/api/sync/SyncActions.java | 4 +-
.../provisioning/java/AsyncConnectorFacade.java | 82 +-
.../provisioning/java/ConnectorFacadeProxy.java | 166 +---
.../provisioning/java/ConnectorManager.java | 76 +-
.../DefaultAnyObjectProvisioningManager.java | 72 +-
.../java/DefaultGroupProvisioningManager.java | 84 +-
.../java/DefaultUserProvisioningManager.java | 152 ++--
.../provisioning/java/VirAttrHandlerImpl.java | 4 +-
.../java/data/AbstractAnyDataBinder.java | 9 +-
.../java/data/ConnInstanceDataBinderImpl.java | 48 +-
.../java/data/RealmDataBinderImpl.java | 2 +-
.../java/data/ResourceDataBinderImpl.java | 33 +-
.../java/data/TaskDataBinderImpl.java | 3 +-
.../java/job/AbstractSchedTaskJobDelegate.java | 2 +-
.../java/job/SchedulerShutdown.java | 4 -
.../java/job/SpringBeanJobFactory.java | 6 +-
.../core/provisioning/java/job/TaskJob.java | 2 +-
.../notification/NotificationManagerImpl.java | 19 +-
.../AbstractPropagationTaskExecutor.java | 66 +-
.../DBPasswordPropagationActions.java | 2 +-
.../propagation/DefaultPropagationReporter.java | 82 +-
.../LDAPPasswordPropagationActions.java | 2 +-
.../PriorityPropagationTaskExecutor.java | 168 ++--
.../propagation/PropagationManagerImpl.java | 4 +-
.../PropagationTaskCallableImpl.java | 94 +++
.../sync/AbstractProvisioningJobDelegate.java | 104 +--
.../java/sync/AbstractPushResultHandler.java | 18 +-
.../java/sync/AbstractSyncResultHandler.java | 94 +--
.../java/sync/AbstractSyncopeResultHandler.java | 2 +-
.../sync/AnyObjectSyncResultHandlerImpl.java | 11 +-
.../java/sync/DBPasswordSyncActions.java | 8 +-
.../java/sync/DefaultPushActions.java | 6 +-
.../java/sync/DefaultSyncActions.java | 6 +-
.../java/sync/GroupSyncResultHandlerImpl.java | 13 +-
.../java/sync/LDAPMembershipSyncActions.java | 14 +-
.../java/sync/LDAPPasswordSyncActions.java | 4 +-
.../sync/PlainAttrsSyncCorrelationRule.java | 8 +-
.../provisioning/java/sync/SyncJobDelegate.java | 5 +-
.../core/provisioning/java/sync/SyncUtils.java | 4 +-
.../java/sync/UserSyncResultHandlerImpl.java | 17 +-
.../src/main/resources/provisioning.properties | 7 +
.../src/main/resources/provisioningContext.xml | 20 +-
.../core/provisioning/java/AbstractTest.java | 1 +
.../core/provisioning/java/MappingTest.java | 2 +-
.../syncope/core/rest/cxf/AddETagFilter.java | 18 +-
.../rest/cxf/ThreadLocalCleanupListener.java | 2 +-
.../rest/cxf/service/AbstractAnyService.java | 59 +-
.../rest/cxf/service/AbstractServiceImpl.java | 30 +-
.../rest/cxf/service/ConnectorServiceImpl.java | 39 +-
.../rest/cxf/service/LoggerServiceImpl.java | 4 +-
.../rest/cxf/service/ResourceServiceImpl.java | 37 +-
.../rest/cxf/service/UserSelfServiceImpl.java | 11 +-
.../core/rest/cxf/service/UserServiceImpl.java | 7 +-
.../CamelAnyObjectProvisioningManager.java | 37 +-
.../camel/CamelGroupProvisioningManager.java | 45 +-
.../camel/CamelUserProvisioningManager.java | 106 ++-
.../processor/AnyObjectCreateProcessor.java | 13 +-
.../processor/AnyObjectDeleteProcessor.java | 13 +-
.../AnyObjectDeprovisionProcessor.java | 13 +-
.../processor/AnyObjectProvisionProcessor.java | 13 +-
.../processor/AnyObjectUpdateProcessor.java | 13 +-
.../processor/GroupCreateInSyncProcessor.java | 13 +-
.../camel/processor/GroupCreateProcessor.java | 13 +-
.../camel/processor/GroupDeleteProcessor.java | 13 +-
.../processor/GroupDeprovisionProcessor.java | 13 +-
.../processor/GroupProvisionProcessor.java | 13 +-
.../camel/processor/GroupUpdateProcessor.java | 9 +-
.../processor/UserConfirmPwdResetProcessor.java | 12 +-
.../camel/processor/UserCreateProcessor.java | 9 +-
.../camel/processor/UserDeleteProcessor.java | 13 +-
.../processor/UserDeprovisionProcessor.java | 13 +-
.../camel/processor/UserProvisionProcessor.java | 13 +-
.../processor/UserSetStatusInSyncProcessor.java | 2 +-
.../UserStatusPropagationProcessor.java | 14 +-
.../processor/UserUpdateInSyncProcessor.java | 9 +-
.../camel/processor/UserUpdateProcessor.java | 13 +-
.../src/main/resources/provisioning.properties | 8 +
.../src/main/resources/userRoutes.xml | 2 +-
fit/console-reference/pom.xml | 4 +-
fit/core-reference/pom.xml | 9 +-
.../main/resources/all/provisioning.properties | 8 +
.../resources/mariadb/provisioning.properties | 9 +-
.../resources/mysql/provisioning.properties | 9 +-
.../resources/oracle/provisioning.properties | 9 +-
.../resources/postgres/provisioning.properties | 9 +-
.../src/main/resources/provisioning.properties | 9 +-
.../resources/sqlserver/provisioning.properties | 9 +-
.../fit/core/reference/AbstractITCase.java | 98 ++-
.../fit/core/reference/AnyObjectITCase.java | 16 +-
.../core/reference/AuthenticationITCase.java | 40 +-
.../fit/core/reference/CamelRouteITCase.java | 2 +-
.../fit/core/reference/ConnectorITCase.java | 84 +-
.../syncope/fit/core/reference/GroupITCase.java | 227 ++++-
.../fit/core/reference/LoggerITCase.java | 8 +-
.../fit/core/reference/MultitenancyITCase.java | 5 +-
.../core/reference/NotificationTaskITCase.java | 4 +-
.../fit/core/reference/PlainSchemaITCase.java | 11 +-
.../fit/core/reference/PushTaskITCase.java | 4 +-
.../fit/core/reference/ReportITCase.java | 2 +-
.../fit/core/reference/ResourceITCase.java | 16 +-
.../fit/core/reference/SearchITCase.java | 2 +-
.../fit/core/reference/SyncTaskITCase.java | 28 +-
.../syncope/fit/core/reference/UserITCase.java | 471 ++++++-----
.../fit/core/reference/UserSelfITCase.java | 26 +-
.../fit/core/reference/UserWorkflowITCase.java | 16 +-
.../fit/core/reference/VirAttrITCase.java | 90 +-
fit/enduser-reference/pom.xml | 413 +++++++++
.../src/main/resources/context.xml | 23 +
.../src/main/resources/enduser.properties | 30 +
.../src/main/resources/log4j2.xml | 58 ++
.../src/main/webapp/WEB-INF/glassfish-web.xml | 25 +
.../WEB-INF/jboss-deployment-structure.xml | 37 +
.../src/main/webapp/WEB-INF/weblogic.xml | 35 +
fit/pom.xml | 1 +
pom.xml | 97 ++-
427 files changed, 13817 insertions(+), 4765 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
index b5850ad,43944bd..db85db1
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
@@@ -41,10 -37,9 +41,8 @@@ import org.apache.syncope.common.lib.to
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
- import org.apache.syncope.common.lib.wrap.AbstractWrappable;
- import org.apache.syncope.common.lib.wrap.AnyKey;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
@@@ -242,10 -236,10 +239,10 @@@ public class ProvisioningModalPage<T ex
}
if (beans.isEmpty()) {
- window.close(target);
+ modal.close(target);
} else {
- final BulkActionResult res = resourceRestClient.bulkAssociationAction(
- resourceTO.getKey(), anyTypeKind.name(), type, subjectKeys);
- BulkActionResult result =
- resourceRestClient.bulkAssociationAction(resourceTO.getKey(), anyTypeKind.name(), action, anyKeys);
++ BulkActionResult res = resourceRestClient.bulkAssociationAction(resourceTO.getKey(), anyTypeKind.name(),
++ action, anyKeys);
((BasePage) pageRef.getPage()).setModalResult(true);
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmModalPanel.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
index dbb3f37,fdb9f83..730b4cf
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java
@@@ -35,16 -55,51 +35,16 @@@ public abstract class ResourceConnConfP
private final boolean createFlag;
- private List<ConnConfProperty> connConfProperties;
-
- private final WebMarkupContainer connConfPropContainer;
-
- private final AjaxButton check;
-
- public ResourceConnConfPanel(final String id, final ResourceTO resourceTO, final boolean createFlag) {
- super(id);
- setOutputMarkupId(true);
+ public ResourceConnConfPanel(final String id, final IModel<ResourceTO> model, final boolean createFlag) {
+ super(id, model);
this.createFlag = createFlag;
- this.resourceTO = resourceTO;
-
- connConfProperties = getConnConfProperties();
-
- connConfPropContainer = new WebMarkupContainer("connectorPropertiesContainer");
- connConfPropContainer.setOutputMarkupId(true);
- add(connConfPropContainer);
-
- /*
- * the list of overridable connector properties
- */
- final ListView<ConnConfProperty> connPropView = new ConnConfPropertyListView("connectorProperties",
- new PropertyModel<List<ConnConfProperty>>(this, "connConfProperties"),
- false, resourceTO.getConfOverride());
- connPropView.setOutputMarkupId(true);
- connConfPropContainer.add(connPropView);
-
- check = new IndicatingAjaxButton("check", new ResourceModel("check")) {
- private static final long serialVersionUID = -4199438518229098169L;
+ final List<ConnConfProperty> connConfProperties = getConnProperties(model.getObject());
- model.getObject().getConnConfProperties().clear();
- model.getObject().getConnConfProperties().addAll(connConfProperties);
++ model.getObject().getConfOverride().clear();
++ model.getObject().getConfOverride().addAll(connConfProperties);
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- final ResourceTO to = (ResourceTO) form.getModelObject();
-
- if (restClient.check(to)) {
- info(getString("success_connection"));
- } else {
- error(getString("error_connection"));
- }
-
- ((BaseModalPage) getPage()).getFeedbackPanel().refresh(target);
- }
- };
+ setConfPropertyListView("connConfProperties", false);
check.setEnabled(!connConfProperties.isEmpty());
check.setVisible(!connConfProperties.isEmpty());
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
index 330a4c2,ceabd57..dd73ba3
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java
@@@ -23,15 -22,18 +23,17 @@@ import java.util.ArrayList
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
+ import org.apache.commons.collections4.CollectionUtils;
+ import org.apache.commons.collections4.Transformer;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.JexlHelpUtils;
-import org.apache.syncope.client.console.panels.ResourceConnConfPanel.ConnConfModEvent;
import org.apache.syncope.client.console.rest.ConnectorRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDecoratedCheckbox;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
index 2414070,d483411..208afa4
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
@@@ -57,15 -55,11 +56,15 @@@ public class ConnectorRestClient extend
return connectors;
}
- public void create(final ConnInstanceTO connectorTO) {
+ public ConnInstanceTO create(final ConnInstanceTO connectorTO) {
- Set<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConfiguration());
- connectorTO.getConfiguration().clear();
- connectorTO.getConfiguration().addAll(filteredConf);
+ Set<ConnConfProperty> filteredConf = filterProperties(connectorTO.getConf());
+ connectorTO.getConf().clear();
+ connectorTO.getConf().addAll(filteredConf);
- getService(ConnectorService.class).create(connectorTO);
+
+ final ConnectorService service = getService(ConnectorService.class);
+ final Response response = service.create(connectorTO);
+
+ return getObject(service, response.getLocation(), ConnInstanceTO.class);
}
/**
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
index 3a99c1d,f5579cf..3f7672d
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
@@@ -19,9 -19,9 +19,10 @@@
package org.apache.syncope.client.console.rest;
import java.util.List;
+import javax.ws.rs.core.Response;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.common.lib.SyncopeClientException;
+ import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ResourceTO;
http://git-wip-us.apache.org/repos/asf/syncope/blob/77fc5d26/pom.xml
----------------------------------------------------------------------
[37/50] [abbrv] syncope git commit: SYNCOPE-701 first working
implementation
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/editUser.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/editUser.html b/client/enduser/src/main/resources/META-INF/resources/app/views/editUser.html
new file mode 100644
index 0000000..9361cdf
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/editUser.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<!--
+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.
+-->
+<div ng-cloak class="container">
+ <div class="login-container" ng-controller="UserController" ng-init="initUser();" style="box-sizing: border-box; ">
+
+ <div id="form-container" class="col-md-6 col-md-offset-3">
+
+
+ <div>
+ <div class="page-header" style="text-align: left; font-weight: 700;">
+ <span ng-show="createMode">New User</span>
+ <span ng-show="!createMode">User {{user.username}}</span>
+ </div>
+ <div class="breadcrumb-header text-center">
+
+ <!-- the links to our nested states using relative paths -->
+ <!-- add the active class if the state matches our ui-sref -->
+ <!--<div id="status-buttons" class="text-center">-->
+ <div class="row">
+ <div growl reference="2" inline="true"></div>
+ <div id="status-buttons" class="btn-group btn-breadcrumb">
+ <a href="#/self" class="btn btn-default"><i class="glyphicon glyphicon-home"></i></a>
+ <!--add class breadcrumb-disabled-link to buttons to prevent click-->
+ <a ui-sref-active="active" ui-sref=".credentials" class="btn btn-default">Credentials</a>
+ <a ui-sref-active="active" ui-sref=".plainSchemas" class="btn btn-default">Plain Schemas</a>
+ <a ui-sref-active="active" ui-sref=".derivedSchemas" class="btn btn-default">Derived Schemas</a>
+ <a ui-sref-active="active" ui-sref=".virtualSchemas" class="btn btn-default">Virtual Schemas</a>
+ <a ui-sref-active="active" ui-sref=".groups" class="btn btn-default">Groups</a>
+ <a ui-sref-active="active" ui-sref=".resources" class="btn btn-default">Resources</a>
+ </div>
+ </div>
+ </div>
+ <form class="signup-form" name="userForm" ng-submit="saveUser(user)" novalidate>
+
+ <div id="form-views" ui-view>
+
+ <!-- <div class="form-group row">
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="next" ui-sref="create.credentials" class="btn btn-block btn-signin">
+ Start <span class="glyphicon glyphicon-circle-arrow-right"></span>
+ </a>
+ <a id="cancel" href="#/self" class="btn btn-link">Cancel</a>
+ </div>
+ </div>-->
+
+ </div>
+ <!-- <div class="form-actions">
+ <button type="submit" ng-disabled="form.$invalid || vm.dataLoading" class="btn btn-primary" ng-click="saveUser()">Register</button>
+ <img ng-if="vm.dataLoading" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />
+ <a href="#/self" class="btn btn-link">Cancel</a>
+ </div>-->
+ </form>
+ </div>
+ </div>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/generic-error.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/generic-error.html b/client/enduser/src/main/resources/META-INF/resources/app/views/generic-error.html
new file mode 100644
index 0000000..2ca6c58
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/generic-error.html
@@ -0,0 +1,24 @@
+<!--
+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.
+-->
+
+<html>
+ <body>
+ <div>PAGE NOT FOUND</div>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/home.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/home.html b/client/enduser/src/main/resources/META-INF/resources/app/views/home.html
new file mode 100644
index 0000000..ca365ff
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/home.html
@@ -0,0 +1,34 @@
+<!--
+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.
+-->
+
+<html>
+ <body>
+ <div>TITLE GET FROM CONTROLLER:</div>
+ <p>{{title}}</p>
+ <p>{{subtitle}}</p>
+ <p>{{name}}</p>
+
+ <button type="button" ng-click="">Password Reset</button>
+ <button type="button" ng-click="">Self Registration</button>
+ <button type="button" ng-click="">Self Update</button>
+ <button type="button" ng-click="sampleAPI()">Sample</button>
+ <button type="button" ng-click="errorAPI()">Error</button>
+
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/navigationButtons.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/navigationButtons.html b/client/enduser/src/main/resources/META-INF/resources/app/views/navigationButtons.html
new file mode 100644
index 0000000..793334d
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/navigationButtons.html
@@ -0,0 +1,8 @@
+<div class="col-xs-6 col-xs-offset-3">
+ <a ng-show="next !== 'none'" id="next" ui-sref="{{next}}" class="btn btn-default">
+ Next <span class="glyphicon glyphicon-circle-arrow-right"></span>
+ </a>
+ <a ng-show="previous !== 'none'" id="previous" ui-sref="{{previous}}" class="btn btn-default">
+ <span class="glyphicon glyphicon-circle-arrow-left"></span> Previous
+ </a>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/self.html b/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
new file mode 100644
index 0000000..0139697
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/self.html
@@ -0,0 +1,131 @@
+<!--
+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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+ <meta charset="UTF-8"/>
+ <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'/>
+
+ <title>Apache Syncope Enduser - Login</title>
+ </head>
+
+ <body>
+
+ <div ng-cloak class="container">
+
+ <div id="login-container" ng-controller="LoginController" style="box-sizing: border-box; ">
+
+ <!-- <div id="logo">
+ <a href="/">
+ <img class="login-logo" src="img/logo-green.png" />
+ </a>
+ </div>-->
+ <div id="login">
+ <div class="logout">
+ <a href="javascript:void(0);" class="btn btn-danger btn-signin" ng-click="logout()" ng-show="isLogged()" title="Logout">
+ <i class="glyphicon glyphicon-off"></i>
+ </a>
+ </div>
+ <div>
+ <div id="language" class="form-group" ng-controller="LanguageController" ng-init="init()">
+ <div id="languageContainer" class="col-xs-2">
+
+ <select class="form-control" ng-options="language.name for language in languages.availableLanguages track by language.id"
+ ng-model="languages.selectedLanguage" ></select>
+
+ </div>
+ </div>
+
+ <h3>Welcome to Apache Syncope Enduser</h3>
+ <h5 ng-show="!isLogged()">please login to self update</h5>
+
+ <div id="login-form" class="form">
+ <div growl reference="1" inline="true"></div>
+ </div>
+
+ <form id="login-form" class="form" novalidate ng-show="!isLogged()" >
+
+ <div class="form-group">
+ <input autofocus="autofocus" type="text" class="form-control" id="login-username" placeholder="Username"
+ ng-required ng-model="credentials.username" placeholder="username">
+ </div>
+
+ <div class="form-group">
+ <input type="password" class="form-control" id="login-password" placeholder="Password"
+ ng-required ng-model="credentials.password" placeholder="password">
+ </div>
+
+ <div class="form-group">
+
+ <button type="submit" id="login-btn" class="btn btn-default btn-signin login-btn" ng-click="login(credentials)">Login</button>
+ <a href="javascript:void(0);" class="btn btn-link" ng-click="selfCreate()">Self Registration</a>
+ <a href="javascript:void(0);" class="btn btn-link" ng-click="passwordReset()">Password Reset</a>
+ </div>
+ </form>
+
+ </div>
+
+ </div>
+
+ </div>
+
+ </div> <!-- /#login -->
+
+ <!-- <div id="initialLoaderDiv">
+ <img src="img/busy.gif" class="ajax-loader"/>
+ </div>-->
+ </div> <!-- /#login-container -->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <!-- <div class="container" ng-cloak ng-controller="LoginController">
+ <div class="card card-container">
+ <img class="login-logo" src="img/logo-green.png" />
+
+ <div growl></div>
+
+ <form class="form-signin" novalidate ng-show="!isLogged()">
+ <input type="text" id="username" class="form-control" ng-required autofocus="autofocus" ng-model="credentials.username" />
+ <input type="password" id="password" class="form-control" required="required" ng-model="credentials.password" />
+
+ <select id="language" style="width: 100%"
+ ng-options="language.name for language in languages.availableLanguages track by language.id"
+ ng-model="languages.selectedLanguage"></select>
+
+ <button type="submit" class="btn btn-lg btn-primary btn-block btn-signin" ng-click="login(credentials)">Login</button>
+ </form>
+
+
+
+ </div>
+ </div>-->
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/user-credentials.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/user-credentials.html b/client/enduser/src/main/resources/META-INF/resources/app/views/user-credentials.html
new file mode 100644
index 0000000..cfd1ba6
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/user-credentials.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<!--
+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.
+-->
+<div id="attribute" class="form-group">
+ <label for="user.username">Username</label>
+ <input name="username" type="text" class="form-control" ng-model="user.username" required placeholder="username" >
+ <p ng-show="(userForm.username.$error.required && !userForm.username.$pristine)" class="text-validation-error">Username is required</p>
+</div>
+
+<div id="attribute" class="form-group">
+ <label for="user.password">Password</label>
+ <input type="password" class="form-control" name="password" ng-model="user.password" equals="{{confirmPassword.value}}"
+ placeholder="password">
+</div>
+
+<div id="attribute" class="form-group">
+ <label for="confirmPassword">Confirm Password</label>
+ <input name="confirmPassword" type="password" class="form-control" equals="{{user.password}}" ng-model="confirmPassword.value"
+ placeholder="confirm password">
+ <p ng-show="userForm.confirmPassword.$error.equals" class="text-validation-error">Password and confirm password must be equal</p>
+</div>
+
+<div id="attribute" class="form-group">
+ <label for="securityQuestion">Security Question</label>
+ <select name="securityQuestion" class="form-control"
+ ng-model="user.securityQuestion"
+ ng-options="securityQuestion.key as securityQuestion.content for securityQuestion in availableSecurityQuestions">
+ <option value="">Select security question</option>
+ </select>
+</div>
+
+<div id="attribute" class="form-group">
+ <label for="securityAnswer">Security Answer</label>
+ <input ng-disabled="user.securityQuestion === initialSecurityQuestion" name="securityAnswer" type="text" class="form-control" ng-model="user.securityAnswer"
+ placeholder="security answer">
+</div>
+
+<div class="form-group row">
+ <navigation-buttons ng-show="createMode" next="create.plainSchemas" previous="none"></navigation-buttons>
+ <navigation-buttons ng-show="!createMode" next="update.plainSchemas" previous="none"></navigation-buttons>
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="cancel" href="#/self" class="btn btn-danger">Cancel</a>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/user-derived-schemas.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/user-derived-schemas.html b/client/enduser/src/main/resources/META-INF/resources/app/views/user-derived-schemas.html
new file mode 100644
index 0000000..a92b9c2
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/user-derived-schemas.html
@@ -0,0 +1,37 @@
+<!--
+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.
+-->
+
+<div id="attribute-derived" class="form-group" >
+ <div>
+ <dynamic-derived-attributes user="user" form="dynamicForm"></dynamic-derived-attributes>
+ </div>
+ <!-- <div style="color:#dd301b" ng-if="attribute.validated == false" class="row-fluid">
+ <div class="col-md-5"></div>
+ <div class="col-md-7">{{attribute.validationMessage| translate }}</div>
+ </div>-->
+ <!--</div>-->
+</div>
+
+<div class="form-group row">
+ <navigation-buttons ng-show="createMode" next="create.virtualSchemas" previous="create.plainSchemas"></navigation-buttons>
+ <navigation-buttons ng-show="!createMode" next="update.virtualSchemas" previous="update.plainSchemas"></navigation-buttons>
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="cancel" href="#/self" class="btn btn-danger">Cancel</a>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/user-groups.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/user-groups.html b/client/enduser/src/main/resources/META-INF/resources/app/views/user-groups.html
new file mode 100644
index 0000000..58475bb
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/user-groups.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!--
+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.
+-->
+
+<div class="form-group row upper-select">
+ <label>Realm</label>
+ <select class="form-control"
+ ng-disabled="true"
+ ng-model="user.realm"
+ ng-required="true">
+ <option ng-repeat="realm in availableRealms" value="{{realm}}">{{realm}}</option>
+ </select>
+</div>
+
+<div class="form-group row">
+ <navigation-buttons ng-show="createMode" next="create.resources" previous="create.virtualSchemas"></navigation-buttons>
+ <navigation-buttons ng-show="!createMode" next="update.resources" previous="update.virtualSchemas"></navigation-buttons>
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="cancel" href="#/self" class="btn btn-danger">Cancel</a>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/user-plain-schemas.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/user-plain-schemas.html b/client/enduser/src/main/resources/META-INF/resources/app/views/user-plain-schemas.html
new file mode 100644
index 0000000..2639197
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/user-plain-schemas.html
@@ -0,0 +1,37 @@
+<!--
+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.
+-->
+
+<div>
+ <dynamic-plain-attributes form="dynamicForm" user="user"></dynamic-plain-attributes>
+</div>
+
+<!-- <div style="color:#dd301b" ng-if="attribute.validated == false" class="row-fluid">
+ <div class="col-md-5"></div>
+ <div class="col-md-7">{{attribute.validationMessage| translate }}</div>
+ </div>-->
+<!--</div>-->
+<!--</div>-->
+
+<div class="form-group row">
+ <navigation-buttons ng-show="createMode" next="create.derivedSchemas" previous="create.credentials"></navigation-buttons>
+ <navigation-buttons ng-show="!createMode" next="update.derivedSchemas" previous="update.credentials"></navigation-buttons>
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="cancel" href="#/self" class="btn btn-danger">Cancel</a>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/user-resources.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/user-resources.html b/client/enduser/src/main/resources/META-INF/resources/app/views/user-resources.html
new file mode 100644
index 0000000..91a99f6
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/user-resources.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<!--
+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.
+-->
+
+<div class="form-group row">
+ <navigation-buttons ng-show="createMode" next="none" previous="create.groups"></navigation-buttons>
+ <navigation-buttons ng-show="!createMode" next="none" previous="update.groups"></navigation-buttons>
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="cancel" href="#/self" class="btn btn-danger">Cancel</a>
+ <button id="save" type="submit" class="btn btn-success">Save</button>
+ </div>
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/views/user-virtual-schemas.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/views/user-virtual-schemas.html b/client/enduser/src/main/resources/META-INF/resources/app/views/user-virtual-schemas.html
new file mode 100644
index 0000000..1d77c80
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/views/user-virtual-schemas.html
@@ -0,0 +1,37 @@
+<!--
+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.
+-->
+
+<div id="attribute-virtual" class="form-group">
+ <div>
+ <dynamic-virtual-attributes form="dynamicForm" user="user"></dynamic-virtual-attributes>
+ </div>
+ <!-- <div style="color:#dd301b" ng-if="attribute.validated == false" class="row-fluid">
+ <div class="col-md-5"></div>
+ <div class="col-md-7">{{attribute.validationMessage| translate }}</div>
+ </div>-->
+ <!--</div>-->
+</div>
+
+<div class="form-group row">
+ <navigation-buttons ng-show="createMode" next="create.groups" previous="create.derivedSchemas"></navigation-buttons>
+ <navigation-buttons ng-show="!createMode" next="update.groups" previous="update.derivedSchemas"></navigation-buttons>
+ <div class="col-xs-6 col-xs-offset-3">
+ <a id="cancel" href="#/self" class="btn btn-danger">Cancel</a>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/web-fragment.xml
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/web-fragment.xml b/client/enduser/src/main/resources/META-INF/web-fragment.xml
new file mode 100644
index 0000000..b949d4c
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/web-fragment.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+ http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
+ id="${pom.artifactId}" version="3.1">
+
+ <!--causes problem if deployed with other fragments-->
+ <display-name>Apache Syncope ${syncope.version} Enduser</display-name>
+
+<!-- <context-param>
+ <param-name>configuration</param-name>
+ <param-value>deployment</param-value>
+ </context-param>
+
+ <filter>
+ <filter-name>SyncopeEnduser</filter-name>
+ <filter-class>org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter</filter-class>
+ <init-param>
+ <param-name>filterMappingUrlPattern</param-name>
+ <param-value>/*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.syncope.client.enduser.SyncopeEnduserApplication</param-value>
+ </init-param>
+ </filter>-->
+
+ <filter>
+ <filter-name>SyncopeEnduser</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.syncope.client.enduser.SyncopeEnduserApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>filterMappingUrlPattern</param-name>
+ <param-value>/*</param-value>
+ </init-param>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>SyncopeEnduser</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+
+ <!--SESSION TIMEOUT (MINUTES)-->
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+
+</web-fragment>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/enduser.properties
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/enduser.properties b/client/enduser/src/main/resources/enduser.properties
new file mode 100644
index 0000000..4dd1cbe
--- /dev/null
+++ b/client/enduser/src/main/resources/enduser.properties
@@ -0,0 +1,30 @@
+# 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.
+enduser.directory=${conf.directory}
+scheme=http
+host=localhost
+port=8080
+rootPath=/syncope/rest/
+
+anonymousUser=${anonymousUser}
+anonymousKey=${anonymousKey}
+
+storePassword=true
+
+version=${syncope.version}
+license=${licenseUrl}
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/HomePage.html
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/HomePage.html b/client/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/HomePage.html
new file mode 100644
index 0000000..55d71a4
--- /dev/null
+++ b/client/enduser/src/main/resources/org/apache/syncope/client/enduser/pages/HomePage.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<!--
+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.
+-->
+<html>
+
+</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/test/java/org/apache/syncope/client/enduser/SyncopeEnduserApplicationTest.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/test/java/org/apache/syncope/client/enduser/SyncopeEnduserApplicationTest.java b/client/enduser/src/test/java/org/apache/syncope/client/enduser/SyncopeEnduserApplicationTest.java
new file mode 100644
index 0000000..4a77739
--- /dev/null
+++ b/client/enduser/src/test/java/org/apache/syncope/client/enduser/SyncopeEnduserApplicationTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.enduser;
+
+import org.apache.syncope.client.enduser.pages.HomePage;
+import org.apache.wicket.Session;
+import org.apache.wicket.protocol.http.WebSession;
+import org.apache.wicket.protocol.http.mock.MockHttpServletResponse;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Response;
+import org.apache.wicket.util.tester.WicketTester;
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SyncopeEnduserApplicationTest {
+
+ private WicketTester tester;
+
+ static class SyncopeEnduserMockSession extends WebSession {
+
+ private static final long serialVersionUID = -2500230416352618497L;
+
+ SyncopeEnduserMockSession(Request request) {
+ super(request);
+ }
+ }
+
+ @Before
+ public void setUp() {
+ tester = new WicketTester(new SyncopeEnduserApplication() {
+
+ private static final long serialVersionUID = 1445165406200746511L;
+
+ @Override
+ public Session newSession(Request request, Response response) {
+ return new SyncopeEnduserMockSession(request);
+ }
+
+ });
+ }
+
+ @Test
+ public void testRedirectToIndex() {
+ tester.setFollowRedirects(false);
+ tester.startPage(HomePage.class);
+ tester.assertNoErrorMessage();
+ MockHttpServletResponse response = tester.getLastResponse();
+ Assert.assertThat(response.getRedirectLocation(), CoreMatchers.equalTo("app/"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 68bd1e5..0cefabb 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -60,6 +60,7 @@ under the License.
<module>lib</module>
<module>console</module>
<module>cli</module>
+ <module>enduser</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
index 6587d1d..f0c2d15 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java
@@ -46,22 +46,14 @@ public final class Entitlement {
public static final String REALM_DELETE = "REALM_DELETE";
- public static final String ANYTYPECLASS_LIST = "ANYTYPECLASS_LIST";
-
public static final String ANYTYPECLASS_CREATE = "ANYTYPECLASS_CREATE";
- public static final String ANYTYPECLASS_READ = "ANYTYPECLASS_READ";
-
public static final String ANYTYPECLASS_UPDATE = "ANYTYPECLASS_UPDATE";
public static final String ANYTYPECLASS_DELETE = "ANYTYPECLASS_DELETE";
- public static final String ANYTYPE_LIST = "ANYTYPE_LIST";
-
public static final String ANYTYPE_CREATE = "ANYTYPE_CREATE";
- public static final String ANYTYPE_READ = "ANYTYPE_READ";
-
public static final String ANYTYPE_UPDATE = "ANYTYPE_UPDATE";
public static final String ANYTYPE_DELETE = "ANYTYPE_DELETE";
@@ -90,8 +82,6 @@ public final class Entitlement {
public static final String SCHEMA_CREATE = "SCHEMA_CREATE";
- public static final String SCHEMA_READ = "SCHEMA_READ";
-
public static final String SCHEMA_UPDATE = "SCHEMA_UPDATE";
public static final String SCHEMA_DELETE = "SCHEMA_DELETE";
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeClassLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeClassLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeClassLogic.java
index 1743370..7ccd2bf 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeClassLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeClassLogic.java
@@ -44,7 +44,7 @@ public class AnyTypeClassLogic extends AbstractTransactionalLogic<AnyTypeClassTO
@Autowired
private AnyTypeClassDAO anyTypeClassDAO;
- @PreAuthorize("hasRole('" + Entitlement.ANYTYPECLASS_READ + "')")
+ @PreAuthorize("isAuthenticated()")
public AnyTypeClassTO read(final String key) {
AnyTypeClass anyType = anyTypeClassDAO.find(key);
if (anyType == null) {
@@ -56,7 +56,7 @@ public class AnyTypeClassLogic extends AbstractTransactionalLogic<AnyTypeClassTO
return binder.getAnyTypeClassTO(anyType);
}
- @PreAuthorize("hasRole('" + Entitlement.ANYTYPECLASS_LIST + "')")
+ @PreAuthorize("isAuthenticated()")
public List<AnyTypeClassTO> list() {
return CollectionUtils.collect(anyTypeClassDAO.findAll(), new Transformer<AnyTypeClass, AnyTypeClassTO>() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
index 1ff60c7..6bd0fd5 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AnyTypeLogic.java
@@ -46,7 +46,7 @@ public class AnyTypeLogic extends AbstractTransactionalLogic<AnyTypeTO> {
@Autowired
private AnyTypeDAO anyTypeDAO;
- @PreAuthorize("hasRole('" + Entitlement.ANYTYPE_READ + "')")
+ @PreAuthorize("isAuthenticated()")
public AnyTypeTO read(final String key) {
AnyType anyType = anyTypeDAO.find(key);
if (anyType == null) {
@@ -58,7 +58,7 @@ public class AnyTypeLogic extends AbstractTransactionalLogic<AnyTypeTO> {
return binder.getAnyTypeTO(anyType);
}
- @PreAuthorize("hasRole('" + Entitlement.ANYTYPE_LIST + "')")
+ @PreAuthorize("isAuthenticated()")
public List<AnyTypeTO> list() {
return CollectionUtils.collect(anyTypeDAO.findAll(), new Transformer<AnyType, AnyTypeTO>() {
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
index 3da4a76..cbd5f64 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
@@ -180,7 +180,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<AbstractSchemaTO> {
return result;
}
- @PreAuthorize("hasRole('" + Entitlement.SCHEMA_READ + "')")
+ @PreAuthorize("isAuthenticated()")
@SuppressWarnings("unchecked")
public <T extends AbstractSchemaTO> T read(final SchemaType schemaType, final String schemaName) {
T read;
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
index e5cf78b..811b429 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/AuthenticationITCase.java
@@ -118,15 +118,6 @@ public class AuthenticationITCase extends AbstractITCase {
@Test
public void testUserSchemaAuthorization() {
- // 0. create a role that can only read schemas
- RoleTO roleTO = new RoleTO();
- roleTO.setName("authRole" + getUUIDString());
- roleTO.getEntitlements().add(Entitlement.SCHEMA_READ);
- roleTO.getRealms().add("/odd");
-
- roleTO = createRole(roleTO);
- assertNotNull(roleTO);
-
String schemaName = "authTestSchema" + getUUIDString();
// 1. create a schema (as admin)
@@ -140,8 +131,6 @@ public class AuthenticationITCase extends AbstractITCase {
// 2. create an user with the role created above (as admin)
UserTO userTO = UserITCase.getUniqueSampleTO("auth@test.org");
- userTO.getRoles().add(roleTO.getKey());
-
userTO = createUser(userTO).getAny();
assertNotNull(userTO);
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/pom.xml b/fit/enduser-reference/pom.xml
new file mode 100644
index 0000000..aee8f79
--- /dev/null
+++ b/fit/enduser-reference/pom.xml
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.syncope</groupId>
+ <artifactId>syncope-fit</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Apache Syncope FIT Enduser Reference</name>
+ <description>Apache Syncope FIT Enduser Reference</description>
+ <groupId>org.apache.syncope.fit</groupId>
+ <artifactId>syncope-fit-enduser-reference</artifactId>
+ <packaging>war</packaging>
+
+ <properties>
+ <rootpom.basedir>${basedir}/../..</rootpom.basedir>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.syncope.client</groupId>
+ <artifactId>syncope-client-enduser</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>javax.servlet.jsp-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency><!--
+-->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency><!--
+-->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency><!--
+-->
+ <dependency>
+ <groupId>com.lmax</groupId>
+ <artifactId>disruptor</artifactId>
+ </dependency><!--
+-->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>provided</scope>
+ </dependency><!--
+-->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+
+ <!-- TEST -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.syncope.fit</groupId>
+ <artifactId>syncope-fit-build-tools</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.tirasa.connid.bundles.soap</groupId>
+ <artifactId>wssample</artifactId>
+ <type>war</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency><!--
+
+ SELENIUM INTEGRATION TEST
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-java</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-api</artifactId>
+ <scope>test</scope>
+ </dependency>-->
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <container>
+ <dependencies>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ </dependency>
+ </dependencies>
+ </container>
+ <configuration>
+ <type>standalone</type>
+ <properties>
+ <cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
+ <cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
+ <cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
+
+ <cargo.jvmargs>-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ </properties>
+ <configfiles>
+ <configfile>
+ <file>${project.build.directory}/classes/context.xml</file>
+ <todir>conf/</todir>
+ <tofile>context.xml</tofile>
+ </configfile>
+ </configfiles>
+ </configuration>
+ <deployables>
+ <deployable>
+ <groupId>net.tirasa.connid.bundles.soap</groupId>
+ <artifactId>wssample</artifactId>
+ <type>war</type>
+ <properties>
+ <context>wssample</context>
+ </properties>
+ </deployable>
+ <deployable>
+ <groupId>org.apache.syncope.fit</groupId>
+ <artifactId>syncope-fit-build-tools</artifactId>
+ <type>war</type>
+ <properties>
+ <context>syncope-fit-build-tools</context>
+ </properties>
+ </deployable>
+ <deployable>
+ <location>${basedir}/../core-reference/target/syncope-fit-core-reference-${project.version}</location>
+ <pingURL>http://localhost:${cargo.servlet.port}/syncope/cacheStats.jsp</pingURL>
+ <pingTimeout>60000</pingTimeout>
+ <properties>
+ <context>syncope</context>
+ </properties>
+ </deployable>
+ <deployable>
+ <location>${project.build.directory}/${project.build.finalName}</location>
+ <properties>
+ <context>syncope-enduser</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <resourceIncludes>src/main/resources/**/*.properties</resourceIncludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>ianal-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>debug</id>
+
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+
+ <build>
+ <defaultGoal>clean verify cargo:run</defaultGoal>
+
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <configuration>
+ <properties>
+ <cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
+ -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ </properties>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>skipTests</id>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <deployables>
+ <deployable>
+ <location>${project.build.directory}/${project.build.finalName}.war</location>
+ </deployable>
+ </deployables>
+ </configuration>
+ <executions>
+ <execution>
+ <id>install-container</id>
+ <phase>package</phase>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>start-container</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>jrebel</id>
+
+ <properties>
+ <javaagent>-javaagent:${env.REBEL_HOME}/jrebel.jar</javaagent>
+ </properties>
+
+ <build>
+ <defaultGoal>clean verify cargo:run</defaultGoal>
+
+ <plugins>
+ <plugin>
+ <groupId>org.zeroturnaround</groupId>
+ <artifactId>jrebel-maven-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <classpath>
+ <fallback>default</fallback>
+ <resources>
+ <resource/>
+ <resource>
+ <directory>${basedir}/../../client/enduser/target/classes</directory>
+ </resource>
+ </resources>
+ </classpath>
+
+ <web>
+ <resources>
+ <resource/>
+ <resource>
+ <target>/</target>
+ <directory>${basedir}/../../client/enduser/target/classes/META-INF/resources/</directory>
+ </resource>
+ </resources>
+ </web>
+
+ <alwaysGenerate>true</alwaysGenerate>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-rebel-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <configuration>
+ <properties>
+ <cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
+ -noverify ${javaagent} -Drebel.spring_plugin=true
+ -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
+ </properties>
+ </configuration>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>apache-release</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/src/main/resources/context.xml
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/main/resources/context.xml b/fit/enduser-reference/src/main/resources/context.xml
new file mode 100644
index 0000000..471d561
--- /dev/null
+++ b/fit/enduser-reference/src/main/resources/context.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+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.
+-->
+<Context>
+ <!-- Disable session persistence across Tomcat restarts -->
+ <Manager pathname=""/>
+</Context>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/src/main/resources/enduser.properties
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/main/resources/enduser.properties b/fit/enduser-reference/src/main/resources/enduser.properties
new file mode 100644
index 0000000..96b0dea
--- /dev/null
+++ b/fit/enduser-reference/src/main/resources/enduser.properties
@@ -0,0 +1,30 @@
+# 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.
+enduser.directory=${conf.directory}
+scheme=http
+host=localhost
+port=9080
+rootPath=/syncope/rest/
+
+anonymousUser=${anonymousUser}
+anonymousKey=${anonymousKey}
+
+storePassword=true
+
+version=${syncope.version}
+license=${licenseUrl}
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/main/resources/log4j2.xml b/fit/enduser-reference/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..ced0e34
--- /dev/null
+++ b/fit/enduser-reference/src/main/resources/log4j2.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<configuration status="WARN">
+
+ <appenders>
+
+ <RollingRandomAccessFile name="main" fileName="${log.directory}/enduser.log"
+ filePattern="${log.directory}/enduser-%d{yyyy-MM-dd}.log.gz"
+ immediateFlush="false" append="true">
+ <PatternLayout>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
+ </PatternLayout>
+ <Policies>
+ <TimeBasedTriggeringPolicy/>
+ <SizeBasedTriggeringPolicy size="250 MB"/>
+ </Policies>
+ </RollingRandomAccessFile>
+
+ </appenders>
+
+ <loggers>
+
+ <asyncLogger name="org.apache.syncope.client.lib" additivity="false" level="OFF">
+ <appender-ref ref="main"/>
+ </asyncLogger>
+
+ <asyncLogger name="org.apache.syncope.client.enduser" additivity="false" level="DEBUG">
+ <appender-ref ref="main"/>
+ </asyncLogger>
+
+ <asyncLogger name="org.apache.wicket" additivity="false" level="DEBUG">
+ <appender-ref ref="main"/>
+ </asyncLogger>
+
+ <root level="DEBUG">
+ <appender-ref ref="main"/>
+ </root>
+
+ </loggers>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/src/main/webapp/WEB-INF/glassfish-web.xml
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/main/webapp/WEB-INF/glassfish-web.xml b/fit/enduser-reference/src/main/webapp/WEB-INF/glassfish-web.xml
new file mode 100644
index 0000000..6400bc2
--- /dev/null
+++ b/fit/enduser-reference/src/main/webapp/WEB-INF/glassfish-web.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+
+-->
+<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD
+GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
+<glassfish-web-app error-url="">
+ <class-loader delegate="false"/>
+</glassfish-web-app>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/fit/enduser-reference/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
new file mode 100644
index 0000000..f38ebfc
--- /dev/null
+++ b/fit/enduser-reference/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
+ <deployment>
+ <exclude-subsystems>
+ <subsystem name="webservices"/>
+ <subsystem name="jaxrs"/>
+ </exclude-subsystems>
+ <dependencies>
+ <module name="org.apache.xalan"/>
+ </dependencies>
+ <exclusions>
+ <module name="javax.ws.rs.api"/>
+ <module name="org.apache.cxf"/>
+ <module name="org.apache.cxf.impl"/>
+ <module name="org.slf4j"/>
+ <module name="org.slf4j.impl"/>
+ </exclusions>
+ </deployment>
+</jboss-deployment-structure>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/enduser-reference/src/main/webapp/WEB-INF/weblogic.xml
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/main/webapp/WEB-INF/weblogic.xml b/fit/enduser-reference/src/main/webapp/WEB-INF/weblogic.xml
new file mode 100644
index 0000000..6e6bd30
--- /dev/null
+++ b/fit/enduser-reference/src/main/webapp/WEB-INF/weblogic.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
+ http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
+
+ <context-root>syncope-console</context-root>
+
+ <container-descriptor>
+ <prefer-application-packages>
+ <package-name>org.apache.commons.*</package-name>
+ <package-name>org.slf4j.*</package-name>
+ <package-name>com.fasterxml.jackson.*</package-name>
+ </prefer-application-packages>
+ </container-descriptor>
+
+</weblogic-web-app>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index 203e414..072e37a 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -60,6 +60,7 @@ under the License.
<module>build-tools</module>
<module>core-reference</module>
<module>console-reference</module>
+ <module>enduser-reference</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bfdfd51..a5ee74a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -388,7 +388,20 @@ under the License.
<wicket.version>7.1.0</wicket.version>
<wicket-jqueryui.version>7.1.0</wicket-jqueryui.version>
-
+
+ <angular.version>1.4.7</angular.version>
+ <angular-route.version>1.4.7</angular-route.version>
+ <angular-resource.version>1.4.7</angular-resource.version>
+ <angular-cookies.version>1.4.7</angular-cookies.version>
+ <angular-animate.version>1.4.7</angular-animate.version>
+ <angular-ui-router.version>0.2.15</angular-ui-router.version>
+ <angular-ui-bootstrap.version>0.14.0</angular-ui-bootstrap.version>
+ <angular-ui-select.version>0.13.1</angular-ui-select.version>
+ <angular-sanitize.version>1.4.7</angular-sanitize.version>
+ <angular-growl-2.version>0.7.3</angular-growl-2.version>
+ <select2.version>3.4.8</select2.version>
+ <FileSaver.version>0.0.2</FileSaver.version>
+
<izpack.version>5.0.5</izpack.version>
<httpclient.version>4.3.6</httpclient.version>
<maven-invoker.version>2.1.1</maven-invoker.version>
@@ -999,6 +1012,79 @@ under the License.
<artifactId>jquery-cookie</artifactId>
<version>${jquery-cookie.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular</artifactId>
+ <version>${angular.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-route</artifactId>
+ <version>${angular-route.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-resource</artifactId>
+ <version>${angular-resource.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-cookies</artifactId>
+ <version>${angular-cookies.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-router</artifactId>
+ <version>${angular-ui-router.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-animate</artifactId>
+ <version>${angular-animate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-bootstrap</artifactId>
+ <version>${angular-ui-bootstrap.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-select</artifactId>
+ <version>${angular-ui-select.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-sanitize</artifactId>
+ <version>${angular-sanitize.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-growl-2</artifactId>
+ <version>${angular-growl-2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>select2</artifactId>
+ <version>${select2.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>jquery</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>FileSaver.js</artifactId>
+ <version>${FileSaver.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>com.beust</groupId>
+ <artifactId>jcommander</artifactId>
+ <version>1.47</version>
+ </dependency>
<dependency>
<groupId>org.codehaus.izpack</groupId>
@@ -1376,6 +1462,7 @@ under the License.
<exclude>**/META-INF/cxf/**</exclude>
<exclude>**/META-INF/services/**</exclude>
<exclude>**/META-INF/MANIFEST.MF</exclude>
+ <exclude>**/META-INF/resources/app/views/**</exclude>
<exclude>**/*.csv</exclude>
<exclude>**/archetype-resources/**</exclude>
<exclude>**/AdminLTE*/**</exclude>
[40/50] [abbrv] syncope git commit: This closes #11
Posted by fm...@apache.org.
This closes #11
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/714557e6
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/714557e6
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/714557e6
Branch: refs/heads/SYNCOPE-156
Commit: 714557e64f309bd4975ed55bb7d182a7727c4667
Parents: 223a64e
Author: Andrea Patricelli <an...@tirasa.net>
Authored: Fri Oct 30 10:31:21 2015 +0100
Committer: Andrea Patricelli <an...@tirasa.net>
Committed: Fri Oct 30 10:31:21 2015 +0100
----------------------------------------------------------------------
pom.xml | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/714557e6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a5ee74a..f4482f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1079,7 +1079,6 @@ under the License.
<version>${FileSaver.version}</version>
</dependency>
-
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
[11/50] [abbrv] syncope git commit: Upgrading Wicket jQuery UI
Posted by fm...@apache.org.
Upgrading Wicket jQuery UI
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7866cdba
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7866cdba
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7866cdba
Branch: refs/heads/SYNCOPE-156
Commit: 7866cdba5a3d8c9626916b8d388e5b37fa97a2e0
Parents: 586df51
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Oct 27 11:33:17 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Oct 27 11:33:17 2015 +0100
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/7866cdba/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9875081..01ff942 100644
--- a/pom.xml
+++ b/pom.xml
@@ -387,7 +387,7 @@ under the License.
<jsplumb.version>1.7.5</jsplumb.version>
<wicket.version>7.1.0</wicket.version>
- <wicket-jqueryui.version>7.0.2</wicket-jqueryui.version>
+ <wicket-jqueryui.version>7.1.0</wicket-jqueryui.version>
<izpack.version>5.0.5</izpack.version>
<httpclient.version>4.3.6</httpclient.version>
[28/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
index cf00ffd..db297f3 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/VirAttrITCase.java
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.fit.core.reference;
-import static org.apache.syncope.fit.core.reference.AbstractITCase.getUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -26,6 +25,7 @@ import static org.junit.Assert.assertTrue;
import java.util.Locale;
import java.util.Map;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
@@ -44,6 +44,7 @@ import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.VirSchemaTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -73,7 +74,7 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(8L).build());
// 1. create user
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 2. check for virtual attribute value
@@ -86,7 +87,7 @@ public class VirAttrITCase extends AbstractITCase {
userPatch.getVirAttrs().add(attrTO("virtualdata", "virtualupdated"));
// 3. update virtual attribute
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
// 4. check for virtual attribute value
@@ -124,11 +125,12 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getVirAttrs().add(attrTO(virSchema.getKey(), "virtualvalue"));
userTO.getResources().add(RESOURCE_NAME_WS2);
- userTO = createUser(userTO);
- assertNotNull(userTO);
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertNotNull(result);
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(RESOURCE_NAME_WS2, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
ConnObjectTO connObjectTO =
resourceService.readConnObject(RESOURCE_NAME_WS2, AnyTypeKind.USER.name(), userTO.getKey());
@@ -142,11 +144,12 @@ public class VirAttrITCase extends AbstractITCase {
userPatch.setKey(userTO.getKey());
userPatch.getVirAttrs().add(attrTO(virSchema.getKey(), "virtualvalue2"));
- userTO = updateUser(userPatch);
- assertNotNull(userTO);
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ result = updateUser(userPatch);
+ assertNotNull(result);
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(RESOURCE_NAME_WS2, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
connObjectTO = resourceService.readConnObject(RESOURCE_NAME_WS2, AnyTypeKind.USER.name(), userTO.getKey());
assertEquals("virtualvalue2", connObjectTO.getPlainAttrMap().get("COMPANYNAME").getValues().get(0));
@@ -158,7 +161,8 @@ public class VirAttrITCase extends AbstractITCase {
StatusPatch statusPatch = new StatusPatch();
statusPatch.setKey(userTO.getKey());
statusPatch.setType(StatusPatchType.SUSPEND);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertEquals("suspended", userTO.getStatus());
connObjectTO = resourceService.readConnObject(RESOURCE_NAME_WS2, AnyTypeKind.USER.name(), userTO.getKey());
@@ -167,7 +171,8 @@ public class VirAttrITCase extends AbstractITCase {
statusPatch = new StatusPatch();
statusPatch.setKey(userTO.getKey());
statusPatch.setType(StatusPatchType.REACTIVATE);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertEquals("active", userTO.getStatus());
connObjectTO = resourceService.readConnObject(RESOURCE_NAME_WS2, AnyTypeKind.USER.name(), userTO.getKey());
@@ -181,11 +186,12 @@ public class VirAttrITCase extends AbstractITCase {
userPatch.setKey(userTO.getKey());
userPatch.getPlainAttrs().add(attrAddReplacePatch("surname", "Surname2"));
- userTO = updateUser(userPatch);
- assertNotNull(userTO);
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(RESOURCE_NAME_WS2, userTO.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ result = updateUser(userPatch);
+ assertNotNull(result);
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(RESOURCE_NAME_WS2, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
connObjectTO = resourceService.readConnObject(RESOURCE_NAME_WS2, AnyTypeKind.USER.name(), userTO.getKey());
assertEquals("Surname2", connObjectTO.getPlainAttrMap().get("SURNAME").getValues().get(0));
@@ -211,7 +217,7 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_DBVIRATTR);
// 1. create user
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
// 2. check for virtual attribute value
@@ -240,7 +246,7 @@ public class VirAttrITCase extends AbstractITCase {
userPatch.getVirAttrs().add(attrTO("virtualdata", "virtualupdated"));
// 5. update virtual attribute
- actual = updateUser(userPatch);
+ actual = updateUser(userPatch).getAny();
assertNotNull(actual);
// 6. check for virtual attribute value
@@ -303,7 +309,7 @@ public class VirAttrITCase extends AbstractITCase {
// assign resource-csv to user
userTO.getResources().add(RESOURCE_NAME_CSV);
// save user
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
// make std controls about user
assertNotNull(userTO);
assertTrue(RESOURCE_NAME_CSV.equals(userTO.getResources().iterator().next()));
@@ -327,11 +333,12 @@ public class VirAttrITCase extends AbstractITCase {
resource(RESOURCE_NAME_WS2).
build());
- toBeUpdated = updateUser(userPatch);
- assertNotNull(toBeUpdated);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
+ toBeUpdated = result.getAny();
assertTrue(toBeUpdated.getVirAttrs().iterator().next().getValues().contains("test@testoneone.com"));
// check if propagates correctly with assertEquals on size of tasks list
- assertEquals(2, toBeUpdated.getPropagationStatusTOs().size());
+ assertEquals(2, result.getPropagationStatuses().size());
} finally {
// restore mapping of resource-csv
csv.getProvisions().get(0).setMapping(origMapping);
@@ -354,7 +361,7 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_DBVIRATTR);
// 1. create user
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 2. check for virtual attribute value
@@ -419,7 +426,7 @@ public class VirAttrITCase extends AbstractITCase {
userPatch.setKey(userTO.getKey());
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_WS2).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
userTO = userService.read(userTO.getKey());
@@ -433,7 +440,7 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_LDAP);
userTO.getVirAttrs().add(attrTO("virtualReadOnly", "readOnly"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
// finding no values because the virtual attribute is readonly
assertTrue(userTO.getVirAttrMap().get("virtualReadOnly").getValues().isEmpty());
}
@@ -493,7 +500,7 @@ public class VirAttrITCase extends AbstractITCase {
groupTO.setRealm("/");
groupTO.getVirAttrs().add(attrTO("rvirtualdata", "ml@group.it"));
groupTO.getResources().add(RESOURCE_NAME_LDAP);
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertEquals(1, groupTO.getVirAttrs().size());
assertEquals("ml@group.it", groupTO.getVirAttrs().iterator().next().getValues().get(0));
// -------------------------------------------
@@ -511,10 +518,11 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(groupTO.getKey()).build());
- userTO = createUser(userTO);
- assertEquals(2, userTO.getPropagationStatusTOs().size());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(1).getStatus());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertEquals(2, result.getPropagationStatuses().size());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(1).getStatus());
+ userTO = result.getAny();
JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
@@ -542,7 +550,7 @@ public class VirAttrITCase extends AbstractITCase {
userTO.getMemberships().clear();
userTO.getVirAttrs().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO.getVirAttrMap().get("virtualReadOnly"));
}
@@ -560,7 +568,7 @@ public class VirAttrITCase extends AbstractITCase {
// virtualdata is mapped with username
userTO.getVirAttrs().add(attrTO("virtualdata", "syncope501@apache.org"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO.getVirAttrMap().get("virtualdata"));
assertEquals("syncope501@apache.org", userTO.getVirAttrMap().get("virtualdata").getValues().get(0));
@@ -571,7 +579,7 @@ public class VirAttrITCase extends AbstractITCase {
// change virtual attribute value
userPatch.getVirAttrs().add(attrTO("virtualdata", "syncope501_updated@apache.org"));
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
// 3. check that user virtual attribute has really been updated
@@ -633,7 +641,7 @@ public class VirAttrITCase extends AbstractITCase {
// assign resource-ldap691 to user
userTO.getResources().add(ldap.getKey());
// save user
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
// make std controls about user
assertNotNull(userTO);
assertTrue(ldap.getKey().equals(userTO.getResources().iterator().next()));
@@ -652,7 +660,7 @@ public class VirAttrITCase extends AbstractITCase {
value("test@issue691.dom4.org").
build());
- UserTO updated = updateUser(userPatch);
+ UserTO updated = updateUser(userPatch).getAny();
assertNotNull(updated);
assertEquals(2, updated.getVirAttrs().iterator().next().getValues().size(), 0);
assertTrue(updated.getVirAttrs().iterator().next().getValues().contains("test@issue691.dom3.org"));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 01ff942..bfdfd51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -801,7 +801,7 @@ under the License.
<artifactId>avalon-framework-impl</artifactId>
<version>4.3.1</version>
</dependency>
-
+
<!-- Activiti -->
<dependency>
<groupId>org.activiti</groupId>
@@ -1282,7 +1282,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>2.4.1</version>
+ <version>2.4.2</version>
</plugin>
<plugin>
@@ -1663,7 +1663,7 @@ under the License.
<link>http://camel.apache.org/maven/current/camel-core/apidocs/</link>
<link>http://camel.apache.org/maven/current/camel-spring/apidocs/</link>
<link>http://ci.apache.org/projects/wicket/apidocs/7.x/</link>
- <link>http://docs.spring.io/spring/docs/4.1.x/javadoc-api/</link>
+ <link>http://docs.spring.io/spring/docs/4.2.x/javadoc-api/</link>
<link>http://docs.spring.io/spring-security/site/docs/4.0.x/apidocs/</link>
<link>http://activiti.org/javadocs/</link>
</links>
[29/50] [abbrv] syncope git commit: [SYNCOPE-141][SYNCOPE-142]
Implementation completed
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
index 9a54b7f..64f0008 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/MultitenancyITCase.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
import java.security.AccessControlException;
import java.util.List;
import java.util.Locale;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.lib.SyncopeClient;
@@ -36,6 +37,7 @@ import org.apache.syncope.common.lib.to.MappingItemTO;
import org.apache.syncope.common.lib.to.MappingTO;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.SyncTaskTO;
@@ -120,7 +122,8 @@ public class MultitenancyITCase extends AbstractITCase {
Response response = adminClient.getService(UserService.class).create(user);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
- user = response.readEntity(UserTO.class);
+ user = response.readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(user);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
index f494e85..853b17c 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/NotificationTaskITCase.java
@@ -329,7 +329,7 @@ public class NotificationTaskITCase extends AbstractTaskITCase {
GroupTO groupTO = new GroupTO();
groupTO.setName(groupName);
groupTO.setRealm("/even/two");
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
// 3. verify
@@ -385,7 +385,7 @@ public class NotificationTaskITCase extends AbstractTaskITCase {
UserTO userTO = UserITCase.getUniqueSampleTO(MAIL_ADDRESS);
userTO.getMemberships().add(new MembershipTO.Builder().group(7L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
return userTO.getUsername();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
index ad35195..d275712 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java
@@ -27,12 +27,14 @@ import static org.junit.Assert.fail;
import java.security.AccessControlException;
import java.util.List;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.to.MembershipTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.CipherAlgorithm;
@@ -213,7 +215,7 @@ public class PlainSchemaITCase extends AbstractITCase {
userTO.getAuxClasses().add(typeClass.getKey());
userTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "1.2"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
schemaTO.setType(AttrSchemaType.Long);
@@ -241,13 +243,14 @@ public class PlainSchemaITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("issue259@syncope.apache.org");
userTO.getAuxClasses().add(typeClass.getKey());
userTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "1"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserTO newUserTO = SerializationUtils.clone(userTO);
newUserTO.getMemberships().add(new MembershipTO.Builder().group(2L).build());
- userTO = userService.update(newUserTO).readEntity(UserTO.class);
+ userTO = userService.update(newUserTO).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
}
@@ -267,7 +270,7 @@ public class PlainSchemaITCase extends AbstractITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("issue260@syncope.apache.org");
userTO.getAuxClasses().add(typeClass.getKey());
userTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "1.2"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
schemaTO.setUniqueConstraint(false);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
index d980345..91b7840 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PushTaskITCase.java
@@ -274,7 +274,7 @@ public class PushTaskITCase extends AbstractTaskITCase {
groupTO.getPlainAttrs().add(attrTO(schemaTO.getKey(), "all"));
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
String resourceName = "resource-ldap-grouponly";
@@ -319,6 +319,8 @@ public class PushTaskITCase extends AbstractTaskITCase {
task.setPerformUpdate(true);
task.setUnmatchingRule(UnmatchingRule.ASSIGN);
task.setMatchingRule(MatchingRule.UPDATE);
+ task.getFilters().put(AnyTypeKind.GROUP.name(),
+ SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo(groupTO.getName()).query());
response = taskService.create(task);
PushTaskTO push = getObject(response.getLocation(), TaskService.class, PushTaskTO.class);
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ReportITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ReportITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ReportITCase.java
index 49c24e7..86f3b1d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ReportITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ReportITCase.java
@@ -140,7 +140,7 @@ public class ReportITCase extends AbstractITCase {
}
private void checkExport(final Long execId, final ReportExecExportFormat fmt) throws IOException {
- final Response response = reportService.exportExecutionResult(execId, fmt);
+ Response response = reportService.exportExecutionResult(execId, fmt);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusInfo().getStatusCode());
assertNotNull(response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION));
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
index 9aa64ce..90f5796 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ResourceITCase.java
@@ -455,7 +455,7 @@ public class ResourceITCase extends AbstractITCase {
public void read() {
ResourceTO resource = resourceService.read(RESOURCE_NAME_DBVIRATTR);
assertNotNull(resource);
-
+
ProvisionTO provision = resource.getProvision(AnyTypeKind.USER.name());
assertNotNull(provision);
assertFalse(provision.getMapping().getItems().isEmpty());
@@ -535,7 +535,7 @@ public class ResourceITCase extends AbstractITCase {
for (int i = 0; i < 10; i++) {
GroupTO group = GroupITCase.getSampleTO("group");
group.getResources().add(RESOURCE_NAME_LDAP);
- group = createGroup(group);
+ group = createGroup(group).getAny();
groupKeys.add(group.getKey());
}
@@ -575,7 +575,7 @@ public class ResourceITCase extends AbstractITCase {
builder.pagedResultsCookie(list.getPagedResultsCookie());
}
} while (list.getPagedResultsCookie() != null);
-
+
assertEquals(totalRead, read.size());
assertTrue(totalRead >= 10);
} finally {
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
index 6011c93..59d158d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java
@@ -119,7 +119,7 @@ public class SearchITCase extends AbstractITCase {
public void searchByDynGroup() {
GroupTO group = GroupITCase.getBasicSampleTO("dynMembership");
group.setUDynMembershipCond("cool==true");
- group = createGroup(group);
+ group = createGroup(group).getAny();
assertNotNull(group);
PagedResult<UserTO> matchingUsers = userService.search(
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
index ef73242..aed0682 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java
@@ -53,6 +53,7 @@ import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.policy.SyncPolicyTO;
import org.apache.syncope.common.lib.to.MappingItemTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.SyncTaskTO;
import org.apache.syncope.common.lib.to.TaskExecTO;
import org.apache.syncope.common.lib.to.UserTO;
@@ -153,7 +154,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
inUserTO.getAuxClasses().add("csv");
inUserTO.getDerAttrs().add(attrTO("csvuserid", null));
- inUserTO = createUser(inUserTO);
+ inUserTO = createUser(inUserTO).getAny();
assertNotNull(inUserTO);
assertFalse(inUserTO.getResources().contains(RESOURCE_NAME_CSV));
@@ -388,7 +389,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
String originalLocation = anyObjectTO.getPlainAttrMap().get("location").getValues().get(0);
assertFalse(originalLocation.startsWith(PrefixMappingItemTransformer.PREFIX));
- anyObjectTO = createAnyObject(anyObjectTO);
+ anyObjectTO = createAnyObject(anyObjectTO).getAny();
assertNotNull(anyObjectTO);
// 2. verify that PrefixMappingItemTransformer was applied during propagation
@@ -456,7 +457,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(7L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals("testuser2", userTO.getUsername());
assertEquals(1, userTO.getMemberships().size());
@@ -496,7 +497,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
assertEquals(2, userTO.getMemberships().size());
assertEquals(4, userTO.getResources().size());
} finally {
- UserTO dUserTO = deleteUser(userTO.getKey());
+ UserTO dUserTO = deleteUser(userTO.getKey()).getAny();
assertNotNull(dUserTO);
}
}
@@ -560,7 +561,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_WS2);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
// change email in order to unmatch the second user
UserPatch userPatch = new UserPatch();
@@ -587,11 +588,12 @@ public class SyncTaskITCase extends AbstractTaskITCase {
UserTO userTO = UserITCase.getUniqueSampleTO("syncope272@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- userTO = createUser(userTO);
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ userTO = result.getAny();
try {
assertNotNull(userTO);
- assertEquals(1, userTO.getPropagationStatusTOs().size());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
TaskExecTO taskExecTO = execProvisioningTask(taskService, 24L, 50, false);
@@ -621,7 +623,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_WS2);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
userTO = userService.read(userTO.getKey());
@@ -665,7 +667,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
UserTO user = UserITCase.getUniqueSampleTO("syncope313-db@syncope.apache.org");
user.setPassword("security123");
user.getResources().add(RESOURCE_NAME_TESTDB);
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
assertFalse(user.getResources().isEmpty());
@@ -721,7 +723,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
UserTO user = UserITCase.getUniqueSampleTO("syncope313-ldap@syncope.apache.org");
user.setPassword(oldCleanPassword);
user.getResources().add(RESOURCE_NAME_LDAP);
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
assertFalse(user.getResources().isEmpty());
@@ -730,7 +732,7 @@ public class SyncTaskITCase extends AbstractTaskITCase {
UserPatch userPatch = new UserPatch();
userPatch.setKey(user.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value(newCleanPassword).build());
- user = updateUser(userPatch);
+ user = updateUser(userPatch).getAny();
// 3. Check that the Syncope user now has the changed password
Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create(user.getUsername(), newCleanPassword).self();
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
index 1811805..0fb428d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserITCase.java
@@ -33,13 +33,17 @@ import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.Transformer;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.cxf.common.util.Base64Utility;
@@ -72,6 +76,7 @@ import org.apache.syncope.common.lib.to.PropagationStatus;
import org.apache.syncope.common.lib.to.PropagationTaskTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.RealmTO;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -164,12 +169,12 @@ public class UserITCase extends AbstractITCase {
assertNotNull(tasks);
assertFalse(tasks.getResult().isEmpty());
- long newMaxId = tasks.getResult().iterator().next().getKey();
+ long newMaxKey = tasks.getResult().iterator().next().getKey();
- assertTrue(newMaxId > maxKey);
+ assertTrue(newMaxKey > maxKey);
// get last task
- PropagationTaskTO taskTO = taskService.read(newMaxId);
+ PropagationTaskTO taskTO = taskService.read(newMaxKey);
assertNotNull(taskTO);
assertFalse(taskTO.getExecutions().isEmpty());
assertEquals(PropagationTaskExecStatus.NOT_ATTEMPTED.name(), taskTO.getExecutions().get(0).getStatus());
@@ -188,7 +193,7 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().add(attrTO("fullname", userId));
userTO.getPlainAttrs().add(attrTO("surname", userId));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertTrue(userTO.getResources().isEmpty());
@@ -200,25 +205,26 @@ public class UserITCase extends AbstractITCase {
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_WS2).build());
try {
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
}
// 3. update assigning a resource NOT forcing mandatory constraints
- // AND primary: must fail with PropagationException
+ // AND priority: must fail with PropagationException
userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("newPassword123").build());
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_WS1).build());
- userTO = updateUser(userPatch);
- assertNotNull(userTO.getPropagationStatusTOs().get(0).getFailureReason());
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result.getPropagationStatuses().get(0).getFailureReason());
+ userTO = result.getAny();
// 4. update assigning a resource NOT forcing mandatory constraints
- // BUT not primary: must succeed
+ // BUT not priority: must succeed
userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("newPassword123456").build());
@@ -244,14 +250,14 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().remove(type);
try {
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
}
userTO.getPlainAttrs().add(type);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
}
@@ -271,7 +277,7 @@ public class UserITCase extends AbstractITCase {
userTO.setPassword("newPassword12");
try {
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
fail();
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
@@ -280,7 +286,7 @@ public class UserITCase extends AbstractITCase {
userTO.getAuxClasses().add("csv");
userTO.getDerAttrs().add(attrTO("csvuserid", null));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals(Collections.singleton("resource-csv-enforcing"), userTO.getResources());
}
@@ -289,10 +295,10 @@ public class UserITCase extends AbstractITCase {
public void createUserWithDbPropagation() {
UserTO userTO = getUniqueSampleTO("yyy@yyy.yyy");
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- userTO = createUser(userTO);
- assertNotNull(userTO);
- assertEquals(1, userTO.getPropagationStatusTOs().size());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertNotNull(result);
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
}
@Test(expected = SyncopeClientException.class)
@@ -368,7 +374,7 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().add(attrTO("activationDate", null));
// 1. create user
- UserTO newUserTO = createUser(userTO);
+ UserTO newUserTO = createUser(userTO).getAny();
assertNotNull(newUserTO);
@@ -480,19 +486,19 @@ public class UserITCase extends AbstractITCase {
// specify a propagation
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
long key = userTO.getKey();
- userTO = deleteUser(key);
-
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = deleteUser(key);
+ assertNotNull(result);
+ userTO = result.getAny();
assertEquals(key, userTO.getKey());
assertTrue(userTO.getPlainAttrs().isEmpty());
// check for propagation result
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
try {
userService.delete(userTO.getKey());
@@ -508,19 +514,20 @@ public class UserITCase extends AbstractITCase {
// specify a propagation
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
- long id = userTO.getKey();
- userTO = userService.read(id);
- userTO = deleteUser(userTO.getKey());
+ long key = userTO.getKey();
+ userTO = userService.read(key);
- assertNotNull(userTO);
- assertEquals(id, userTO.getKey());
+ ProvisioningResult<UserTO> result = deleteUser(userTO.getKey());
+ assertNotNull(result);
+ userTO = result.getAny();
+ assertEquals(key, userTO.getKey());
assertTrue(userTO.getPlainAttrs().isEmpty());
// check for propagation result
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
try {
userService.read(userTO.getKey());
@@ -577,7 +584,7 @@ public class UserITCase extends AbstractITCase {
@Test
public void readWithMailAddressAsUserName() {
- UserTO userTO = createUser(getUniqueSampleTO("mail@domain.org"));
+ UserTO userTO = createUser(getUniqueSampleTO("mail@domain.org")).getAny();
userTO = userService.read(userTO.getKey());
assertNotNull(userTO);
}
@@ -586,7 +593,7 @@ public class UserITCase extends AbstractITCase {
public void updateWithouPassword() {
UserTO userTO = getUniqueSampleTO("updatewithout@password.com");
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
@@ -596,7 +603,7 @@ public class UserITCase extends AbstractITCase {
attrTO(new AttrTO.Builder().schema("cn").build()).
build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
assertNotNull(userTO.getDerAttrMap());
@@ -607,7 +614,7 @@ public class UserITCase extends AbstractITCase {
public void updateInvalidPassword() {
UserTO userTO = getSampleTO("updateinvalid@password.com");
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
@@ -622,7 +629,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("updatesame@password.com");
userTO.setRealm("/even/two");
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
@@ -638,7 +645,7 @@ public class UserITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(8L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertFalse(userTO.getDerAttrs().isEmpty());
assertEquals(1, userTO.getMemberships().size());
@@ -660,7 +667,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getMemberships().add(new MembershipPatch.Builder().operation(PatchOperation.ADD_REPLACE).
membershipTO(userTO.getMemberships().get(0)).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
// issue SYNCOPE-15
@@ -689,13 +696,13 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("pwdonly@t.com");
userTO.getMemberships().add(new MembershipTO.Builder().group(8L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("newPassword123").resource(RESOURCE_NAME_WS2).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
// check for changePwdDate
assertNotNull(userTO.getChangePwdDate());
@@ -728,7 +735,7 @@ public class UserITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(8L).build());
// 1. create user
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// get the new task list
@@ -753,7 +760,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getPlainAttrs().add(attrAddReplacePatch("surname", "surname2"));
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
@@ -800,7 +807,7 @@ public class UserITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(11L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertNotNull(userTO.getToken());
@@ -812,7 +819,8 @@ public class UserITCase extends AbstractITCase {
statusPatch.setKey(userTO.getKey());
statusPatch.setType(StatusPatchType.ACTIVATE);
statusPatch.setToken(userTO.getToken());
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertNull(userTO.getToken());
@@ -826,7 +834,7 @@ public class UserITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(7L).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals(ActivitiDetector.isActivitiEnabledForUsers(syncopeService)
@@ -836,14 +844,16 @@ public class UserITCase extends AbstractITCase {
StatusPatch statusPatch = new StatusPatch();
statusPatch.setKey(userTO.getKey());
statusPatch.setType(StatusPatchType.SUSPEND);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("suspended", userTO.getStatus());
statusPatch = new StatusPatch();
statusPatch.setKey(userTO.getKey());
statusPatch.setType(StatusPatchType.REACTIVATE);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("active", userTO.getStatus());
}
@@ -862,7 +872,7 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_TESTDB);
userTO.getResources().add(RESOURCE_NAME_LDAP);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals(ActivitiDetector.isActivitiEnabledForUsers(syncopeService)
? "active"
@@ -876,7 +886,8 @@ public class UserITCase extends AbstractITCase {
statusPatch.setOnSyncope(true);
statusPatch.getResources().add(RESOURCE_NAME_TESTDB);
statusPatch.getResources().add(RESOURCE_NAME_LDAP);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("suspended", userTO.getStatus());
@@ -895,7 +906,8 @@ public class UserITCase extends AbstractITCase {
statusPatch.getResources().add(RESOURCE_NAME_LDAP);
userService.status(statusPatch);
statusPatch.setType(StatusPatchType.REACTIVATE);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("suspended", userTO.getStatus());
@@ -909,7 +921,8 @@ public class UserITCase extends AbstractITCase {
statusPatch.setOnSyncope(true);
statusPatch.getResources().add(RESOURCE_NAME_TESTDB);
- userTO = userService.status(statusPatch).readEntity(UserTO.class);
+ userTO = userService.status(statusPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("active", userTO.getStatus());
@@ -924,7 +937,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().clear();
userTO.getVirAttrs().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
AttrTO loginDate = userTO.getPlainAttrMap().get("loginDate");
@@ -938,7 +951,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getPlainAttrs().add(new AttrPatch.Builder().
operation(PatchOperation.ADD_REPLACE).attrTO(loginDate).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
loginDate = userTO.getPlainAttrMap().get("loginDate");
@@ -946,12 +959,63 @@ public class UserITCase extends AbstractITCase {
assertEquals(2, loginDate.getValues().size());
}
+ private void verifyAsyncResult(final List<PropagationStatus> statuses) {
+ assertEquals(3, statuses.size());
+
+ Map<String, PropagationStatus> byResource = new HashMap<>(3);
+ MapUtils.populateMap(byResource, statuses, new Transformer<PropagationStatus, String>() {
+
+ @Override
+ public String transform(final PropagationStatus status) {
+ return status.getResource();
+ }
+ });
+ assertEquals(PropagationTaskExecStatus.SUCCESS, byResource.get(RESOURCE_NAME_LDAP).getStatus());
+ assertEquals(PropagationTaskExecStatus.CREATED, byResource.get(RESOURCE_NAME_TESTDB).getStatus());
+ assertEquals(PropagationTaskExecStatus.CREATED, byResource.get(RESOURCE_NAME_TESTDB2).getStatus());
+ }
+
+ @Test
+ public void async() {
+ UserService asyncService =
+ clientFactory.create(ADMIN_UNAME, ADMIN_PWD).nullPriorityAsync(UserService.class, true);
+
+ UserTO user = getUniqueSampleTO("async@syncope.apache.org");
+ user.getResources().add(RESOURCE_NAME_TESTDB);
+ user.getResources().add(RESOURCE_NAME_TESTDB2);
+ user.getResources().add(RESOURCE_NAME_LDAP);
+
+ ProvisioningResult<UserTO> result = asyncService.create(user).readEntity(
+ new GenericType<ProvisioningResult<UserTO>>() {
+ });
+ assertNotNull(result);
+ verifyAsyncResult(result.getPropagationStatuses());
+
+ UserPatch userPatch = new UserPatch();
+ userPatch.setKey(result.getAny().getKey());
+ userPatch.setPassword(new PasswordPatch.Builder().
+ onSyncope(true).resources(RESOURCE_NAME_LDAP, RESOURCE_NAME_TESTDB, RESOURCE_NAME_TESTDB2).
+ value("password321").build());
+
+ result = asyncService.update(userPatch).readEntity(
+ new GenericType<ProvisioningResult<UserTO>>() {
+ });
+ assertNotNull(result);
+ verifyAsyncResult(result.getPropagationStatuses());
+
+ result = asyncService.delete(result.getAny().getKey()).readEntity(
+ new GenericType<ProvisioningResult<UserTO>>() {
+ });
+ assertNotNull(result);
+ verifyAsyncResult(result.getPropagationStatuses());
+ }
+
@Test(expected = EmptyResultDataAccessException.class)
public void issue213() {
UserTO userTO = getUniqueSampleTO("issue213@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_TESTDB);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals(1, userTO.getResources().size());
@@ -968,7 +1032,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getResources().add(
new StringPatchItem.Builder().operation(PatchOperation.DELETE).value(RESOURCE_NAME_TESTDB).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertTrue(userTO.getResources().isEmpty());
jdbcTemplate.queryForObject("SELECT id FROM test WHERE id=?", String.class, userTO.getUsername());
@@ -979,7 +1043,7 @@ public class UserITCase extends AbstractITCase {
UserTO inUserTO = getUniqueSampleTO("issue234@syncope.apache.org");
inUserTO.getResources().add(RESOURCE_NAME_LDAP);
- UserTO userTO = createUser(inUserTO);
+ UserTO userTO = createUser(inUserTO).getAny();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
@@ -987,7 +1051,7 @@ public class UserITCase extends AbstractITCase {
userPatch.setKey(userTO.getKey());
userPatch.setUsername(new StringReplacePatchItem.Builder().value("1" + userTO.getUsername()).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
assertEquals("1" + inUserTO.getUsername(), userTO.getUsername());
}
@@ -999,7 +1063,7 @@ public class UserITCase extends AbstractITCase {
userTO.getMemberships().clear();
userTO.getDerAttrs().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
@@ -1009,10 +1073,10 @@ public class UserITCase extends AbstractITCase {
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_TESTDB).build());
- userTO = updateUser(userPatch);
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
- List<PropagationStatus> propagations = userTO.getPropagationStatusTOs();
+ List<PropagationStatus> propagations = result.getPropagationStatuses();
assertNotNull(propagations);
assertEquals(1, propagations.size());
@@ -1030,13 +1094,12 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().clear();
userTO.getResources().add(RESOURCE_NAME_CSV);
- userTO = createUser(userTO);
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertNotNull(result);
- List<PropagationStatus> propagations = userTO.getPropagationStatusTOs();
+ List<PropagationStatus> propagations = result.getPropagationStatuses();
assertNotNull(propagations);
assertEquals(1, propagations.size());
-
assertNotEquals(PropagationTaskExecStatus.SUCCESS, propagations.get(0).getStatus());
String resource = propagations.get(0).getResource();
@@ -1071,7 +1134,7 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_CSV);
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertNotNull(actual.getDerAttrMap().get("csvuserid"));
@@ -1159,7 +1222,7 @@ public class UserITCase extends AbstractITCase {
}
user.setUsername("YYY" + user.getUsername());
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
} finally {
realm.setAccountPolicy(oldAccountPolicy);
@@ -1186,29 +1249,29 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_CSV);
- UserTO actual = createUser(userTO);
- assertNotNull(actual);
- assertEquals(2, actual.getMemberships().size());
- assertEquals(1, actual.getResources().size());
+ userTO = createUser(userTO).getAny();
+ assertNotNull(userTO);
+ assertEquals(2, userTO.getMemberships().size());
+ assertEquals(1, userTO.getResources().size());
ConnObjectTO connObjectTO =
- resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
+ resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), userTO.getKey());
assertNotNull(connObjectTO);
// -----------------------------------
// Remove the first membership: de-provisioning shouldn't happen
// -----------------------------------
UserPatch userPatch = new UserPatch();
- userPatch.setKey(actual.getKey());
+ userPatch.setKey(userTO.getKey());
userPatch.getMemberships().add(new MembershipPatch.Builder().
- operation(PatchOperation.DELETE).membershipTO(actual.getMemberships().get(0)).build());
+ operation(PatchOperation.DELETE).membershipTO(userTO.getMemberships().get(0)).build());
- actual = updateUser(userPatch);
- assertNotNull(actual);
- assertEquals(1, actual.getMemberships().size());
+ userTO = updateUser(userPatch).getAny();
+ assertNotNull(userTO);
+ assertEquals(1, userTO.getMemberships().size());
- connObjectTO = resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
+ connObjectTO = resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), userTO.getKey());
assertNotNull(connObjectTO);
// -----------------------------------
@@ -1216,17 +1279,17 @@ public class UserITCase extends AbstractITCase {
// Remove the resource assigned directly: de-provisioning shouldn't happen
// -----------------------------------
userPatch = new UserPatch();
- userPatch.setKey(actual.getKey());
+ userPatch.setKey(userTO.getKey());
userPatch.getResources().add(new StringPatchItem.Builder().operation(PatchOperation.DELETE).
- value(actual.getResources().iterator().next()).build());
+ value(userTO.getResources().iterator().next()).build());
- actual = updateUser(userPatch);
- assertNotNull(actual);
- assertEquals(1, actual.getMemberships().size());
- assertFalse(actual.getResources().isEmpty());
+ userTO = updateUser(userPatch).getAny();
+ assertNotNull(userTO);
+ assertEquals(1, userTO.getMemberships().size());
+ assertFalse(userTO.getResources().isEmpty());
- connObjectTO = resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
+ connObjectTO = resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), userTO.getKey());
assertNotNull(connObjectTO);
// -----------------------------------
@@ -1234,18 +1297,18 @@ public class UserITCase extends AbstractITCase {
// Remove the first membership: de-provisioning should happen
// -----------------------------------
userPatch = new UserPatch();
- userPatch.setKey(actual.getKey());
+ userPatch.setKey(userTO.getKey());
userPatch.getMemberships().add(new MembershipPatch.Builder().
- operation(PatchOperation.DELETE).membershipTO(actual.getMemberships().get(0)).build());
+ operation(PatchOperation.DELETE).membershipTO(userTO.getMemberships().get(0)).build());
- actual = updateUser(userPatch);
- assertNotNull(actual);
- assertTrue(actual.getMemberships().isEmpty());
- assertTrue(actual.getResources().isEmpty());
+ userTO = updateUser(userPatch).getAny();
+ assertNotNull(userTO);
+ assertTrue(userTO.getMemberships().isEmpty());
+ assertTrue(userTO.getResources().isEmpty());
try {
- resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
+ resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), userTO.getKey());
fail("Read should not succeeed");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.NotFound, e.getType());
@@ -1259,11 +1322,12 @@ public class UserITCase extends AbstractITCase {
userTO.getVirAttrs().clear();
userTO.getResources().add(RESOURCE_NAME_LDAP);
- userTO = createUser(userTO);
- assertNotNull(userTO);
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(RESOURCE_NAME_LDAP, userTO.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertNotNull(result);
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(RESOURCE_NAME_LDAP, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
// 2. delete this user
userService.delete(userTO.getKey());
@@ -1315,11 +1379,12 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_DBVIRATTR);
- userTO = createUser(userTO);
- assertNotNull(userTO);
- assertFalse(userTO.getPropagationStatusTOs().isEmpty());
- assertEquals(RESOURCE_NAME_DBVIRATTR, userTO.getPropagationStatusTOs().get(0).getResource());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertNotNull(result);
+ assertFalse(result.getPropagationStatuses().isEmpty());
+ assertEquals(RESOURCE_NAME_DBVIRATTR, result.getPropagationStatuses().get(0).getResource());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
ConnObjectTO connObjectTO =
resourceService.readConnObject(RESOURCE_NAME_DBVIRATTR, AnyTypeKind.USER.name(), userTO.getKey());
@@ -1339,7 +1404,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("syncope266@apache.org");
userTO.getResources().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
@@ -1349,7 +1414,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_UPDATE).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
}
@@ -1358,10 +1423,10 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("syncope279@apache.org");
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_TIMEOUT);
- userTO = createUser(userTO);
- assertEquals(RESOURCE_NAME_TIMEOUT, userTO.getPropagationStatusTOs().get(0).getResource());
- assertNotNull(userTO.getPropagationStatusTOs().get(0).getFailureReason());
- assertEquals(PropagationTaskExecStatus.FAILURE, userTO.getPropagationStatusTOs().get(0).getStatus());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertEquals(RESOURCE_NAME_TIMEOUT, result.getPropagationStatuses().get(0).getResource());
+ assertNotNull(result.getPropagationStatuses().get(0).getFailureReason());
+ assertEquals(PropagationTaskExecStatus.FAILURE, result.getPropagationStatuses().get(0).getStatus());
}
@Test
@@ -1373,7 +1438,7 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_TESTDB);
userTO.getResources().add(RESOURCE_NAME_TESTDB2);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertTrue(userTO.getResources().contains(RESOURCE_NAME_TESTDB));
assertTrue(userTO.getResources().contains(RESOURCE_NAME_TESTDB2));
@@ -1402,12 +1467,13 @@ public class UserITCase extends AbstractITCase {
userPatch.setPassword(new PasswordPatch.Builder().value(getUUIDString()).onSyncope(false).
resource(RESOURCE_NAME_TESTDB).build());
- userTO = updateUser(userPatch);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ userTO = result.getAny();
// 3a. Chech that only a single propagation took place
- assertNotNull(userTO.getPropagationStatusTOs());
- assertEquals(1, userTO.getPropagationStatusTOs().size());
- assertEquals(RESOURCE_NAME_TESTDB, userTO.getPropagationStatusTOs().iterator().next().getResource());
+ assertNotNull(result.getPropagationStatuses());
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(RESOURCE_NAME_TESTDB, result.getPropagationStatuses().iterator().next().getResource());
// 3b. verify that password hasn't changed on Syncope
assertEquals(pwdOnSyncope, userTO.getPassword());
@@ -1444,21 +1510,22 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("syncope136_AES@apache.org");
userTO.getResources().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
- // 4. update user, assign a propagation primary resource but don't provide any password
+ // 4. update user, assign a propagation priority resource but don't provide any password
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_WS1).build());
userPatch.setPassword(new PasswordPatch.Builder().onSyncope(false).resource(RESOURCE_NAME_WS1).build());
- userTO = updateUser(userPatch);
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
+ userTO = result.getAny();
// 5. verify that propagation was successful
- List<PropagationStatus> props = userTO.getPropagationStatusTOs();
+ List<PropagationStatus> props = result.getPropagationStatuses();
assertNotNull(props);
assertEquals(1, props.size());
PropagationStatus prop = props.iterator().next();
@@ -1477,21 +1544,21 @@ public class UserITCase extends AbstractITCase {
// 1. create user with no resources
UserTO userTO = getUniqueSampleTO("syncope136_Random@apache.org");
userTO.getResources().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
- // 2. update user, assign a propagation primary resource but don't provide any password
+ // 2. update user, assign a propagation priority resource but don't provide any password
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_LDAP).build());
userPatch.setPassword(new PasswordPatch.Builder().onSyncope(false).resource(RESOURCE_NAME_LDAP).build());
- userTO = updateUser(userPatch);
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
// 3. verify that propagation was successful
- List<PropagationStatus> props = userTO.getPropagationStatusTOs();
+ List<PropagationStatus> props = result.getPropagationStatuses();
assertNotNull(props);
assertEquals(1, props.size());
PropagationStatus prop = props.iterator().next();
@@ -1512,11 +1579,11 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().clear();
userTO.getResources().add(RESOURCE_NAME_CSV);
- UserTO actual = createUser(userTO);
- assertNotNull(actual);
+ userTO = createUser(userTO).getAny();
+ assertNotNull(userTO);
ConnObjectTO connObjectTO =
- resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
+ resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), userTO.getKey());
assertNull(connObjectTO.getPlainAttrMap().get("email"));
}
@@ -1528,7 +1595,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getPlainAttrs().add(attrAddReplacePatch("type", "a type"));
- UserTO userTO = updateUser(userPatch);
+ UserTO userTO = updateUser(userPatch).getAny();
assertEquals("a type", userTO.getPlainAttrMap().get("type").getValues().get(0));
}
@@ -1540,7 +1607,7 @@ public class UserITCase extends AbstractITCase {
for (int i = 0; i < 10; i++) {
UserTO userTO = getUniqueSampleTO("bulk_" + i + "@apache.org");
- bulkAction.getTargets().add(String.valueOf(createUser(userTO).getKey()));
+ bulkAction.getTargets().add(String.valueOf(createUser(userTO).getAny().getKey()));
}
// check for a fail
@@ -1585,7 +1652,7 @@ public class UserITCase extends AbstractITCase {
groupTO.setRealm("/");
groupTO.getResources().add(RESOURCE_NAME_LDAP);
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
// 2. create user with LDAP resource and membership of the above group
@@ -1593,7 +1660,7 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_LDAP);
userTO.getMemberships().add(new MembershipTO.Builder().group(groupTO.getKey()).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
// 3. read group on resource, check that user DN is included in uniqueMember
@@ -1609,7 +1676,7 @@ public class UserITCase extends AbstractITCase {
userPatch.getMemberships().add(new MembershipPatch.Builder().operation(PatchOperation.DELETE).
membershipTO(userTO.getMemberships().get(0)).build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
// 5. read group on resource, check that user DN was removed from uniqueMember
@@ -1635,7 +1702,7 @@ public class UserITCase extends AbstractITCase {
groupTO.setRealm("/");
groupTO.getResources().add(RESOURCE_NAME_LDAP);
- groupTO = createGroup(groupTO);
+ groupTO = createGroup(groupTO).getAny();
assertNotNull(groupTO);
// 2. create user with membership of the above group
@@ -1645,7 +1712,7 @@ public class UserITCase extends AbstractITCase {
Base64Utility.encode(IOUtils.readBytesFromStream(getClass().getResourceAsStream("/favicon.jpg")))));
userTO.getMemberships().add(new MembershipTO.Builder().group(groupTO.getKey()).build());
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
assertNotNull(userTO.getPlainAttrMap().get("obscure"));
assertNotNull(userTO.getPlainAttrMap().get("photo"));
@@ -1678,7 +1745,7 @@ public class UserITCase extends AbstractITCase {
// 1. create user without resources
UserTO userTO = getUniqueSampleTO("syncope383@apache.org");
userTO.getResources().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 2. assign resource without specifying a new pwd and check propagation failure
@@ -1686,20 +1753,25 @@ public class UserITCase extends AbstractITCase {
userPatch.setKey(userTO.getKey());
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_TESTDB).build());
- userTO = updateUser(userPatch);
+
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
+ userTO = result.getAny();
assertEquals(RESOURCE_NAME_TESTDB, userTO.getResources().iterator().next());
- assertNotEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
- assertNotNull(userTO.getPropagationStatusTOs().get(0).getFailureReason());
+ assertNotEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ assertNotNull(result.getPropagationStatuses().get(0).getFailureReason());
+ userTO = result.getAny();
// 3. request to change password only on testdb
userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
- userPatch.setPassword(new PasswordPatch.Builder().value(getUUIDString() + "abbcbcbddd123").
- resource(RESOURCE_NAME_TESTDB).build());
+ userPatch.setPassword(
+ new PasswordPatch.Builder().value(getUUIDString() + "abbcbcbddd123").resource(RESOURCE_NAME_TESTDB).
+ build());
- userTO = updateUser(userPatch);
+ result = updateUser(userPatch);
assertEquals(RESOURCE_NAME_TESTDB, userTO.getResources().iterator().next());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
}
@Test
@@ -1715,12 +1787,12 @@ public class UserITCase extends AbstractITCase {
userTO.getPlainAttrs().add(attrTO("fullname", userId));
userTO.getPlainAttrs().add(attrTO("surname", userId));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertTrue(userTO.getResources().isEmpty());
// 2. update assigning a resource NOT forcing mandatory constraints
- // AND primary: must fail with PropagationException
+ // AND priority: must fail with PropagationException
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("newPassword123").build());
@@ -1728,9 +1800,9 @@ public class UserITCase extends AbstractITCase {
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_WS1).build());
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_TESTDB).build());
- userTO = updateUser(userPatch);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
- List<PropagationStatus> propagationStatuses = userTO.getPropagationStatusTOs();
+ List<PropagationStatus> propagationStatuses = result.getPropagationStatuses();
PropagationStatus ws1PropagationStatus = null;
if (propagationStatuses != null) {
for (PropagationStatus propStatus : propagationStatuses) {
@@ -1757,7 +1829,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
@@ -1785,7 +1857,7 @@ public class UserITCase extends AbstractITCase {
userTO.getAuxClasses().add("csv");
userTO.getDerAttrs().add(attrTO("csvuserid", null));
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
@@ -1826,7 +1898,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
@@ -1859,7 +1931,7 @@ public class UserITCase extends AbstractITCase {
userTO.getAuxClasses().add("csv");
userTO.getDerAttrs().add(attrTO("csvuserid", null));
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
@@ -1895,7 +1967,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
@@ -1928,7 +2000,7 @@ public class UserITCase extends AbstractITCase {
userTO.getAuxClasses().add("csv");
userTO.getDerAttrs().add(attrTO("csvuserid", null));
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
@@ -1963,7 +2035,7 @@ public class UserITCase extends AbstractITCase {
userTO.getAuxClasses().add("csv");
userTO.getDerAttrs().add(attrTO("csvuserid", null));
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
@@ -2017,27 +2089,28 @@ public class UserITCase extends AbstractITCase {
userTO.setRealm(realm.getFullPath());
userTO.getPlainAttrs().add(attrTO("makeItDouble", "3"));
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertEquals("6", userTO.getPlainAttrMap().get("makeItDouble").getValues().get(0));
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.getPlainAttrs().add(attrAddReplacePatch("makeItDouble", "7"));
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertEquals("14", userTO.getPlainAttrMap().get("makeItDouble").getValues().get(0));
}
@Test
public void issueSYNCOPE426() {
UserTO userTO = getUniqueSampleTO("syncope426@syncope.apache.org");
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("anotherPassword123").build());
- userTO = userService.update(userPatch).readEntity(UserTO.class);
+ userTO = userService.update(userPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
}
@@ -2046,7 +2119,7 @@ public class UserITCase extends AbstractITCase {
// 1. create user without password
UserTO userTO = getUniqueSampleTO("syncope435@syncope.apache.org");
userTO.setPassword(null);
- userTO = createUser(userTO, false);
+ userTO = createUser(userTO, false).getAny();
assertNotNull(userTO);
// 2. try to update user by subscribing a resource - works but propagation is not even attempted
@@ -2055,17 +2128,20 @@ public class UserITCase extends AbstractITCase {
userPatch.getResources().add(new StringPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_WS1).build());
- userTO = userService.update(userPatch).readEntity(UserTO.class);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
+ userTO = result.getAny();
assertEquals(Collections.singleton(RESOURCE_NAME_WS1), userTO.getResources());
- assertNotEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
- assertTrue(userTO.getPropagationStatusTOs().get(0).getFailureReason().
+ assertNotEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ assertTrue(result.getPropagationStatuses().get(0).getFailureReason().
startsWith("Not attempted because there are mandatory attributes without value(s): [__PASSWORD__]"));
}
@Test
public void ifMatch() {
UserTO userTO = userService.create(getUniqueSampleTO("ifmatch@syncope.apache.org"), true).
- readEntity(UserTO.class);
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertNotNull(userTO.getKey());
@@ -2076,7 +2152,8 @@ public class UserITCase extends AbstractITCase {
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setUsername(new StringReplacePatchItem.Builder().value(userTO.getUsername() + "XX").build());
- userTO = userService.update(userPatch).readEntity(UserTO.class);
+ userTO = userService.update(userPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertTrue(userTO.getUsername().endsWith("XX"));
EntityTag etag1 = adminClient.getLatestEntityTag(userService);
assertFalse(etag.getValue().equals(etag1.getValue()));
@@ -2099,7 +2176,7 @@ public class UserITCase extends AbstractITCase {
// 1. create user with LDAP resource (with 'Generate password if missing' enabled)
UserTO userTO = getUniqueSampleTO("syncope454@syncope.apache.org");
userTO.getResources().add(RESOURCE_NAME_LDAP);
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 2. read resource configuration for LDAP binding
@@ -2132,10 +2209,11 @@ public class UserITCase extends AbstractITCase {
// 1. create user and check that firstname is not propagated on resource with mapping for firstname set to NONE
UserTO userTO = getUniqueSampleTO("issueSYNCOPE493@test.org");
userTO.getResources().add(RESOURCE_NAME_WS1);
- userTO = createUser(userTO);
+ ProvisioningResult<UserTO> result = createUser(userTO);
assertNotNull(userTO);
- assertEquals(1, userTO.getPropagationStatusTOs().size());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
ConnObjectTO actual =
resourceService.readConnObject(RESOURCE_NAME_WS1, AnyTypeKind.USER.name(), userTO.getKey());
@@ -2172,10 +2250,11 @@ public class UserITCase extends AbstractITCase {
userPatch.setPassword(new PasswordPatch());
userPatch.getPlainAttrs().add(attrAddReplacePatch("firstname", "firstnameNew"));
- userTO = updateUser(userPatch);
+ result = updateUser(userPatch);
assertNotNull(userTO);
- assertEquals(1, userTO.getPropagationStatusTOs().size());
- assertEquals(PropagationTaskExecStatus.SUCCESS, userTO.getPropagationStatusTOs().get(0).getStatus());
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(PropagationTaskExecStatus.SUCCESS, result.getPropagationStatuses().get(0).getStatus());
+ userTO = result.getAny();
ConnObjectTO newUser =
resourceService.readConnObject(RESOURCE_NAME_WS1, AnyTypeKind.USER.name(), userTO.getKey());
@@ -2202,7 +2281,7 @@ public class UserITCase extends AbstractITCase {
// 1. create user
UserTO user = UserITCase.getUniqueSampleTO("syncope505-db@syncope.apache.org");
user.setPassword("security123");
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
assertTrue(user.getResources().isEmpty());
@@ -2220,7 +2299,7 @@ public class UserITCase extends AbstractITCase {
userPatch.setPassword(new PasswordPatch.Builder().onSyncope(false).resource(RESOURCE_NAME_TESTDB).build());
- user = updateUser(userPatch);
+ user = updateUser(userPatch).getAny();
assertNotNull(user);
assertEquals(1, user.getResources().size());
@@ -2242,7 +2321,7 @@ public class UserITCase extends AbstractITCase {
// 1. create user
UserTO user = UserITCase.getUniqueSampleTO("syncope505-ldap@syncope.apache.org");
user.setPassword("security123");
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
assertTrue(user.getResources().isEmpty());
@@ -2261,7 +2340,7 @@ public class UserITCase extends AbstractITCase {
userPatch.setPassword(new PasswordPatch.Builder().onSyncope(false).resource(RESOURCE_NAME_LDAP).build());
- user = updateUser(userPatch);
+ user = updateUser(userPatch).getAny();
assertNotNull(user);
assertEquals(1, user.getResources().size());
@@ -2288,7 +2367,7 @@ public class UserITCase extends AbstractITCase {
UserTO userTO = getUniqueSampleTO("syncope391@syncope.apache.org");
userTO.setPassword(null);
- userTO = createUser(userTO, false);
+ userTO = createUser(userTO, false).getAny();
assertNotNull(userTO);
assertNull(userTO.getPassword());
@@ -2307,7 +2386,7 @@ public class UserITCase extends AbstractITCase {
userTO.getAuxClasses().add("csv");
userTO.getResources().add(RESOURCE_NAME_CSV);
- userTO = createUser(userTO, false);
+ userTO = createUser(userTO, false).getAny();
assertNotNull(userTO);
ConnObjectTO connObjectTO =
@@ -2329,7 +2408,7 @@ public class UserITCase extends AbstractITCase {
userTO.getDerAttrs().add(attrTO("csvuserid", null));
userTO.getResources().add(RESOURCE_NAME_CSV);
- userTO = createUser(userTO, false);
+ userTO = createUser(userTO, false).getAny();
assertNotNull(userTO);
connObjectTO =
@@ -2351,7 +2430,7 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_CSV);
// storePassword true by default
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
connObjectTO = resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), userTO.getKey());
@@ -2407,7 +2486,7 @@ public class UserITCase extends AbstractITCase {
userTO.getResources().add(RESOURCE_NAME_LDAP);
- UserTO actual = createUser(userTO);
+ UserTO actual = createUser(userTO).getAny();
assertNotNull(actual);
assertNotNull(actual.getDerAttrMap().get("csvuserid"));
@@ -2420,7 +2499,7 @@ public class UserITCase extends AbstractITCase {
userPatch.setKey(actual.getKey());
userPatch.getPlainAttrs().add(attrAddReplacePatch("postalAddress", "newPostalAddress"));
- actual = updateUser(userPatch);
+ actual = updateUser(userPatch).getAny();
connObjectTO = resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.USER.name(), actual.getKey());
assertNotNull(connObjectTO);
@@ -2457,7 +2536,7 @@ public class UserITCase extends AbstractITCase {
}
user.setPassword("password123");
- user = createUser(user);
+ user = createUser(user).getAny();
assertNotNull(user);
} finally {
realm.setPasswordPolicy(oldPasswordPolicy);
@@ -2482,14 +2561,14 @@ public class UserITCase extends AbstractITCase {
// 3. create group with LDAP resource assigned
GroupTO group = GroupITCase.getBasicSampleTO("syncope686");
group.getResources().add(RESOURCE_NAME_LDAP);
- group = createGroup(group);
+ group = createGroup(group).getAny();
assertNotNull(group);
// 4. create user with no resources
UserTO userTO = getUniqueSampleTO("syncope686@apache.org");
userTO.getResources().clear();
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
// 5. update user with the new group, and don't provide any password
@@ -2498,11 +2577,11 @@ public class UserITCase extends AbstractITCase {
userPatch.getMemberships().add(new MembershipPatch.Builder().operation(PatchOperation.ADD_REPLACE).
membershipTO(new MembershipTO.Builder().group(group.getKey()).build()).build());
- userTO = updateUser(userPatch);
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = updateUser(userPatch);
+ assertNotNull(result);
// 5. verify that propagation was successful
- List<PropagationStatus> props = userTO.getPropagationStatusTOs();
+ List<PropagationStatus> props = result.getPropagationStatuses();
assertNotNull(props);
assertEquals(1, props.size());
PropagationStatus prop = props.iterator().next();
@@ -2521,11 +2600,11 @@ public class UserITCase extends AbstractITCase {
// 1. create groups for indirect resource assignment
GroupTO ldapGroup = GroupITCase.getBasicSampleTO("syncope710.ldap");
ldapGroup.getResources().add(RESOURCE_NAME_LDAP);
- ldapGroup = createGroup(ldapGroup);
+ ldapGroup = createGroup(ldapGroup).getAny();
GroupTO dbGroup = GroupITCase.getBasicSampleTO("syncope710.db");
dbGroup.getResources().add(RESOURCE_NAME_TESTDB);
- dbGroup = createGroup(dbGroup);
+ dbGroup = createGroup(dbGroup).getAny();
// 2. create user with memberships for the groups created above
UserTO userTO = getUniqueSampleTO("syncope710@syncope.apache.org");
@@ -2534,8 +2613,9 @@ public class UserITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(ldapGroup.getKey()).build());
userTO.getMemberships().add(new MembershipTO.Builder().group(dbGroup.getKey()).build());
- userTO = createUser(userTO);
- assertEquals(2, userTO.getPropagationStatusTOs().size());
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertEquals(2, result.getPropagationStatuses().size());
+ userTO = result.getAny();
// 3. request to propagate passwod only to db
UserPatch userPatch = new UserPatch();
@@ -2543,8 +2623,8 @@ public class UserITCase extends AbstractITCase {
userPatch.setPassword(new PasswordPatch.Builder().
onSyncope(false).resource(RESOURCE_NAME_TESTDB).value("newpassword123").build());
- userTO = updateUser(userPatch);
- assertEquals(1, userTO.getPropagationStatusTOs().size());
- assertEquals(RESOURCE_NAME_TESTDB, userTO.getPropagationStatusTOs().get(0).getResource());
+ result = updateUser(userPatch);
+ assertEquals(1, result.getPropagationStatuses().size());
+ assertEquals(RESOURCE_NAME_TESTDB, result.getPropagationStatuses().get(0).getResource());
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
index 083d439..23722f8 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserSelfITCase.java
@@ -31,6 +31,7 @@ import java.io.InputStream;
import java.security.AccessControlException;
import java.util.Map;
import java.util.Set;
+import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
@@ -44,6 +45,7 @@ import org.apache.syncope.common.lib.patch.StringPatchItem;
import org.apache.syncope.common.lib.patch.StringReplacePatchItem;
import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
@@ -85,7 +87,8 @@ public class UserSelfITCase extends AbstractITCase {
SyncopeClient anonClient = clientFactory.create();
UserTO self = anonClient.getService(UserSelfService.class).
create(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org"), true).
- readEntity(UserTO.class);
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(self);
assertEquals("createApproval", self.getStatus());
}
@@ -102,7 +105,8 @@ public class UserSelfITCase extends AbstractITCase {
SyncopeClient anonClient = clientFactory.create();
userTO = anonClient.getService(UserSelfService.class).
create(userTO, true).
- readEntity(UserTO.class);
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(userTO);
assertEquals("createApproval", userTO.getStatus());
assertFalse(userTO.getMemberships().isEmpty());
@@ -146,7 +150,7 @@ public class UserSelfITCase extends AbstractITCase {
@Test
public void updateWithoutApproval() {
// 1. create user as admin
- UserTO created = createUser(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org"));
+ UserTO created = createUser(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org")).getAny();
assertNotNull(created);
assertFalse(created.getUsername().endsWith("XX"));
@@ -157,7 +161,8 @@ public class UserSelfITCase extends AbstractITCase {
SyncopeClient authClient = clientFactory.create(created.getUsername(), "password123");
UserTO updated = authClient.getService(UserSelfService.class).update(userPatch).
- readEntity(UserTO.class);
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(updated);
assertEquals(ActivitiDetector.isActivitiEnabledForUsers(syncopeService)
? "active" : "created", updated.getStatus());
@@ -169,7 +174,7 @@ public class UserSelfITCase extends AbstractITCase {
Assume.assumeTrue(ActivitiDetector.isActivitiEnabledForUsers(syncopeService));
// 1. create user as admin
- UserTO created = createUser(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org"));
+ UserTO created = createUser(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org")).getAny();
assertNotNull(created);
assertFalse(created.getUsername().endsWith("XX"));
@@ -188,7 +193,8 @@ public class UserSelfITCase extends AbstractITCase {
SyncopeClient authClient = clientFactory.create(created.getUsername(), "password123");
UserTO updated = authClient.getService(UserSelfService.class).update(userPatch).
- readEntity(UserTO.class);
+ readEntity(new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(updated);
assertEquals("updateApproval", updated.getStatus());
assertFalse(updated.getUsername().endsWith("XX"));
@@ -223,11 +229,13 @@ public class UserSelfITCase extends AbstractITCase {
@Test
public void delete() {
- UserTO created = createUser(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org"));
+ UserTO created = createUser(UserITCase.getUniqueSampleTO("anonymous@syncope.apache.org")).getAny();
assertNotNull(created);
SyncopeClient authClient = clientFactory.create(created.getUsername(), "password123");
- UserTO deleted = authClient.getService(UserSelfService.class).delete().readEntity(UserTO.class);
+ UserTO deleted = authClient.getService(UserSelfService.class).delete().readEntity(
+ new GenericType<ProvisioningResult<UserTO>>() {
+ }).getAny();
assertNotNull(deleted);
assertEquals(ActivitiDetector.isActivitiEnabledForUsers(syncopeService)
? "deleteApproval" : null, deleted.getStatus());
@@ -373,7 +381,7 @@ public class UserSelfITCase extends AbstractITCase {
userPatch = new UserPatch();
userPatch.setKey(3L);
userPatch.setMustChangePassword(new BooleanReplacePatchItem.Builder().value(true).build());
- UserTO vivaldi = updateUser(userPatch);
+ UserTO vivaldi = updateUser(userPatch).getAny();
assertTrue(vivaldi.isMustChangePassword());
// 2. attempt to access -> fail
http://git-wip-us.apache.org/repos/asf/syncope/blob/1b81e33c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
index d7171e4..cb0bdce 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/UserWorkflowITCase.java
@@ -34,6 +34,7 @@ import org.apache.syncope.common.lib.patch.LongPatchItem;
import org.apache.syncope.common.lib.patch.PasswordPatch;
import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
import org.apache.syncope.common.lib.to.WorkflowFormTO;
@@ -61,7 +62,7 @@ public class UserWorkflowITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(9L).build());
// 1. create user with group 9
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertEquals(1, userTO.getMemberships().size());
assertEquals(9, userTO.getMemberships().get(0).getRightKey());
@@ -83,7 +84,7 @@ public class UserWorkflowITCase extends AbstractITCase {
userPatch.setKey(1L);
userPatch.getRoles().add(new LongPatchItem.Builder().
operation(PatchOperation.ADD_REPLACE).value(2L).build());
- rossini = updateUser(userPatch);
+ rossini = updateUser(userPatch).getAny();
}
assertTrue(rossini.getRoles().contains(2L));
@@ -142,14 +143,15 @@ public class UserWorkflowITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(9L).build());
// 1. create user with group 9 (and verify that no propagation occurred)
- userTO = createUser(userTO);
- assertNotNull(userTO);
+ ProvisioningResult<UserTO> result = createUser(userTO);
+ assertNotNull(result);
+ userTO = result.getAny();
assertEquals(1, userTO.getMemberships().size());
assertEquals(9, userTO.getMemberships().get(0).getRightKey());
assertEquals("createApproval", userTO.getStatus());
assertEquals(Collections.singleton(RESOURCE_NAME_TESTDB), userTO.getResources());
- assertTrue(userTO.getPropagationStatusTOs().isEmpty());
+ assertTrue(result.getPropagationStatuses().isEmpty());
JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
@@ -203,7 +205,7 @@ public class UserWorkflowITCase extends AbstractITCase {
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().value("anotherPassword123").build());
- userTO = updateUser(userPatch);
+ userTO = updateUser(userPatch).getAny();
assertNotNull(userTO);
}
@@ -226,7 +228,7 @@ public class UserWorkflowITCase extends AbstractITCase {
userTO.getMemberships().add(new MembershipTO.Builder().group(9L).build());
// 1. create user with group 9 (and verify that no propagation occurred)
- userTO = createUser(userTO);
+ userTO = createUser(userTO).getAny();
assertNotNull(userTO);
assertNotEquals(0L, userTO.getKey());
assertNotNull(userTO.getCreationDate());
[08/50] [abbrv] syncope git commit: Adjusting and uniforming memory
settings - also attempting to make Travis CI more constant
Posted by fm...@apache.org.
Adjusting and uniforming memory settings - also attempting to make Travis CI more constant
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4aea7769
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4aea7769
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4aea7769
Branch: refs/heads/SYNCOPE-156
Commit: 4aea77695f0bf889a4fc8d095e8060898554b744
Parents: 509d30e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 26 13:38:15 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 26 13:38:15 2015 +0100
----------------------------------------------------------------------
.travis.yml | 2 +-
fit/console-reference/pom.xml | 6 +++---
fit/core-reference/pom.xml | 8 ++++----
pom.xml | 1 +
4 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4aea7769/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 044d84d..c6894ea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,7 +24,7 @@ install: mvn --show-version --quiet -P all,skipTests
#invoker.streamLogs: we cannot access to log files through Travis web ui, so display everything in the console
script:
- sudo rm /etc/mavenrc
- - export MAVEN_OPTS="-Xmx2469m -XX:MaxPermSize=512m -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
+ - export MAVEN_OPTS="-Xmx2048m -Xms1024m -XX:MaxPermSize=512m -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
- mvn --show-version --quiet clean install -Dinvoker.streamLogs=true
notifications:
email:
http://git-wip-us.apache.org/repos/asf/syncope/blob/4aea7769/fit/console-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/console-reference/pom.xml b/fit/console-reference/pom.xml
index 3c89990..e6b2a2b 100644
--- a/fit/console-reference/pom.xml
+++ b/fit/console-reference/pom.xml
@@ -229,7 +229,7 @@ ORYX.Editor.createByUrl = function(modelUrl){"/>
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
- <cargo.jvmargs>-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ <cargo.jvmargs>-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m -Xmx1024m -Xms512m</cargo.jvmargs>
</properties>
<configfiles>
<configfile>
@@ -319,7 +319,7 @@ ORYX.Editor.createByUrl = function(modelUrl){"/>
<configuration>
<properties>
<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
- -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m -Xmx1024m -Xms512m</cargo.jvmargs>
</properties>
</configuration>
</configuration>
@@ -561,7 +561,7 @@ ORYX.Editor.createByUrl = function(modelUrl){"/>
<properties>
<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
-noverify -javaagent:${env.REBEL_HOME}/jrebel.jar -Drebel.spring_plugin=true
- -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m -Xmx1024m -Xms512m</cargo.jvmargs>
</properties>
</configuration>
</configuration>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4aea7769/fit/core-reference/pom.xml
----------------------------------------------------------------------
diff --git a/fit/core-reference/pom.xml b/fit/core-reference/pom.xml
index 724f592..4a3df61 100644
--- a/fit/core-reference/pom.xml
+++ b/fit/core-reference/pom.xml
@@ -237,7 +237,7 @@ under the License.
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
- <cargo.jvmargs>-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ <cargo.jvmargs>-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m -Xmx1024m -Xms512m</cargo.jvmargs>
</properties>
<configfiles>
<configfile>
@@ -671,7 +671,7 @@ under the License.
</container>
<configuration>
<properties>
- <cargo.jvmargs>-Xms1024m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
+ <cargo.jvmargs>-XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:PermSize=512m -XX:MaxPermSize=1024m -Xmx2048m -Xms1024m</cargo.jvmargs>
</properties>
</configuration>
</configuration>
@@ -710,7 +710,7 @@ under the License.
<configuration>
<properties>
<cargo.jvmargs>-Xdebug -Djaxb.debug=true -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
- -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m -Xmx1024m -Xms512m</cargo.jvmargs>
</properties>
</configuration>
</configuration>
@@ -846,7 +846,7 @@ under the License.
<properties>
<cargo.jvmargs>-Xdebug -Djaxb.debug=true -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
-noverify -javaagent:${env.REBEL_HOME}/jrebel.jar -Drebel.spring_plugin=true
- -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m</cargo.jvmargs>
+ -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m -Xmx1024m -Xms512m</cargo.jvmargs>
</properties>
</configuration>
</configuration>
http://git-wip-us.apache.org/repos/asf/syncope/blob/4aea7769/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1d767b2..9875081 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1251,6 +1251,7 @@ under the License.
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<encoding>utf-8</encoding>
<runOrder>alphabetical</runOrder>
+ <argLine>-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Xss256k</argLine>
</configuration>
<executions>
<execution>
[39/50] [abbrv] syncope git commit: SYNCOPE-701 first working
implementation
Posted by fm...@apache.org.
SYNCOPE-701 first working implementation
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/223a64e2
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/223a64e2
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/223a64e2
Branch: refs/heads/SYNCOPE-156
Commit: 223a64e26deff69a4ed8275d0f1348ca4e130a01
Parents: 764fa2e
Author: Andrea Patricelli <an...@tirasa.net>
Authored: Mon Oct 5 15:12:55 2015 +0200
Committer: Andrea Patricelli <an...@tirasa.net>
Committed: Fri Oct 30 10:26:17 2015 +0100
----------------------------------------------------------------------
client/enduser/pom.xml | 194 +++++++++
.../enduser/SyncopeEnduserApplication.java | 157 +++++++
.../client/enduser/SyncopeEnduserSession.java | 279 +++++++++++++
.../client/enduser/adapters/UserTOAdapter.java | 78 ++++
.../client/enduser/model/Credentials.java | 65 +++
.../client/enduser/model/SchemaResponse.java | 79 ++++
.../client/enduser/model/UserTORequest.java | 174 ++++++++
.../syncope/client/enduser/pages/HomePage.java | 35 ++
.../enduser/resources/AbstractBaseResource.java | 58 +++
.../client/enduser/resources/ErrorResource.java | 50 +++
.../client/enduser/resources/LoginResource.java | 84 ++++
.../enduser/resources/LogoutResource.java | 43 ++
.../enduser/resources/SchemaResource.java | 116 ++++++
.../resources/SecurityQuestionResource.java | 73 ++++
.../resources/UserSelfCreateResource.java | 97 +++++
.../enduser/resources/UserSelfReadResource.java | 66 +++
.../resources/UserSelfUpdateResource.java | 96 +++++
.../META-INF/resources/app/css/app.css | 28 ++
.../META-INF/resources/app/css/editUser.css | 253 ++++++++++++
.../META-INF/resources/app/css/login.css | 103 +++++
.../META-INF/resources/app/img/ajax-loader.gif | Bin 0 -> 1924 bytes
.../META-INF/resources/app/img/busy.gif | Bin 0 -> 2834 bytes
.../META-INF/resources/app/img/favicon.png | Bin 0 -> 641 bytes
.../META-INF/resources/app/img/logo-green.png | Bin 0 -> 12178 bytes
.../META-INF/resources/app/img/logo.png | Bin 0 -> 8913 bytes
.../resources/META-INF/resources/app/index.html | 116 ++++++
.../resources/META-INF/resources/app/js/app.js | 283 +++++++++++++
.../app/js/controllers/HomeController.js | 39 ++
.../app/js/controllers/LanguageController.js | 66 +++
.../app/js/controllers/LoginController.js | 93 +++++
.../app/js/controllers/UserController.js | 206 +++++++++
.../app/js/directives/dynamicAttribute.js | 190 +++++++++
.../js/directives/dynamicDerivedAttributes.js | 52 +++
.../app/js/directives/dynamicPlainAttributes.js | 45 ++
.../js/directives/dynamicVirtualAttributes.js | 52 +++
.../resources/app/js/directives/equals.js | 49 +++
.../resources/app/js/directives/loader.js | 32 ++
.../app/js/directives/navigationButtons.js | 31 ++
.../js/directives/passwordStrengthEstimator.js | 102 +++++
.../resources/app/js/filters/propsFilter.js | 52 +++
.../resources/app/js/services/authService.js | 74 ++++
.../resources/app/js/services/realmService.js | 47 +++
.../resources/app/js/services/schemaService.js | 42 ++
.../app/js/services/securityQuestionService.js | 41 ++
.../app/js/services/userSelfService.js | 69 ++++
.../resources/app/views/dynamicAttribute.html | 58 +++
.../app/views/dynamicDerivedAttributes.html | 21 +
.../app/views/dynamicPlainAttributes.html | 22 +
.../app/views/dynamicVirtualAttributes.html | 18 +
.../META-INF/resources/app/views/editUser.html | 73 ++++
.../resources/app/views/generic-error.html | 24 ++
.../META-INF/resources/app/views/home.html | 34 ++
.../resources/app/views/navigationButtons.html | 8 +
.../META-INF/resources/app/views/self.html | 131 ++++++
.../resources/app/views/user-credentials.html | 60 +++
.../app/views/user-derived-schemas.html | 37 ++
.../resources/app/views/user-groups.html | 37 ++
.../resources/app/views/user-plain-schemas.html | 37 ++
.../resources/app/views/user-resources.html | 28 ++
.../app/views/user-virtual-schemas.html | 37 ++
.../main/resources/META-INF/web-fragment.xml | 72 ++++
.../src/main/resources/enduser.properties | 30 ++
.../syncope/client/enduser/pages/HomePage.html | 22 +
.../enduser/SyncopeEnduserApplicationTest.java | 69 ++++
client/pom.xml | 1 +
.../syncope/common/lib/types/Entitlement.java | 10 -
.../syncope/core/logic/AnyTypeClassLogic.java | 4 +-
.../apache/syncope/core/logic/AnyTypeLogic.java | 4 +-
.../apache/syncope/core/logic/SchemaLogic.java | 2 +-
.../core/reference/AuthenticationITCase.java | 11 -
fit/enduser-reference/pom.xml | 413 +++++++++++++++++++
.../src/main/resources/context.xml | 23 ++
.../src/main/resources/enduser.properties | 30 ++
.../src/main/resources/log4j2.xml | 58 +++
.../src/main/webapp/WEB-INF/glassfish-web.xml | 25 ++
.../WEB-INF/jboss-deployment-structure.xml | 37 ++
.../src/main/webapp/WEB-INF/weblogic.xml | 35 ++
fit/pom.xml | 1 +
pom.xml | 89 +++-
79 files changed, 5343 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/pom.xml
----------------------------------------------------------------------
diff --git a/client/enduser/pom.xml b/client/enduser/pom.xml
new file mode 100644
index 0000000..a9dc260
--- /dev/null
+++ b/client/enduser/pom.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.syncope</groupId>
+ <artifactId>syncope-client</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Apache Syncope Client Enduser</name>
+ <description>Apache Syncope Client Enduser</description>
+ <groupId>org.apache.syncope.client</groupId>
+ <artifactId>syncope-client-enduser</artifactId>
+ <packaging>jar</packaging>
+
+ <properties>
+ <rootpom.basedir>${basedir}/../..</rootpom.basedir>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-misc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-extensions</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-datetime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-auth-roles</artifactId>
+ </dependency>
+
+ <!--AngularJS-->
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-route</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-resource</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-router</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-animate</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-cookies</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-growl-2</artifactId>
+ </dependency>
+ <!--Bootstrap-->
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>font-awesome</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>bootstrap-select</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>bootstrap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>ionicons</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-bootstrap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>angular-ui-select</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>angular-sanitize</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>select2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars.bower</groupId>
+ <artifactId>FileSaver.js</artifactId>
+ </dependency>
+
+ <!--Jquery-->
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery-cookie</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery-ui</artifactId>
+ </dependency>
+
+ <!--Logging-->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.syncope.client</groupId>
+ <artifactId>syncope-client-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- TEST -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ </build>
+
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
new file mode 100644
index 0000000..4acc756
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
@@ -0,0 +1,157 @@
+/*
+ * 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.enduser;
+
+import java.io.Serializable;
+import org.apache.syncope.client.enduser.pages.HomePage;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import org.apache.syncope.client.enduser.resources.ErrorResource;
+import org.apache.syncope.client.enduser.resources.LoginResource;
+import org.apache.syncope.client.enduser.resources.LogoutResource;
+import org.apache.syncope.client.enduser.resources.SchemaResource;
+import org.apache.syncope.client.enduser.resources.SecurityQuestionResource;
+import org.apache.syncope.client.enduser.resources.UserSelfCreateResource;
+import org.apache.syncope.client.enduser.resources.UserSelfReadResource;
+import org.apache.syncope.client.enduser.resources.UserSelfUpdateResource;
+import org.apache.wicket.Page;
+import org.apache.wicket.Session;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Response;
+import org.apache.wicket.request.resource.IResource;
+import org.apache.wicket.request.resource.ResourceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SyncopeEnduserApplication extends WebApplication implements Serializable {
+
+ private static final long serialVersionUID = -6445919351044845120L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(SyncopeEnduserApplication.class);
+
+ public static final List<Locale> SUPPORTED_LOCALES = Collections.unmodifiableList(Arrays.asList(
+ new Locale[] {
+ Locale.ENGLISH, Locale.ITALIAN, new Locale("pt", "BR")
+ }));
+
+ @Override
+ protected void init() {
+ super.init();
+
+ LOG.debug("init SyncopeEnduserApplication");
+
+ // resource to provide login functionality managed by wicket
+ mountResource("/api/login", new ResourceReference("login") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new LoginResource();
+ }
+ });
+
+ // resource to provide logout functionality managed by wicket
+ mountResource("/api/logout", new ResourceReference("logout") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new LogoutResource();
+ }
+ });
+
+ // resource to retrieve info about logged user
+ mountResource("/api/self/read", new ResourceReference("userSelfRead") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new UserSelfReadResource();
+ }
+ });
+
+ // resource to provide user self create functionality managed by wicket
+ mountResource("/api/self/create", new ResourceReference("userSelfCreate") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new UserSelfCreateResource();
+ }
+ });
+
+ // resource to provide user self update functionality managed by wicket
+ mountResource("/api/self/update", new ResourceReference("userSelfUpdate") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new UserSelfUpdateResource();
+ }
+ });
+
+ mountResource("/api/schemas", new ResourceReference("schemas") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new SchemaResource();
+ }
+ });
+
+ mountResource("/api/securityQuestions", new ResourceReference("securityQuestions") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new SecurityQuestionResource();
+ }
+ });
+
+ mountResource("/api/error", new ResourceReference("error") {
+
+ private static final long serialVersionUID = -128426276529456602L;
+
+ @Override
+ public IResource getResource() {
+ return new ErrorResource();
+ }
+ });
+ }
+
+ @Override
+ public Class<? extends Page> getHomePage() {
+ return HomePage.class;
+ }
+
+ @Override
+ public Session newSession(final Request request, final Response response) {
+ return new SyncopeEnduserSession(request);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
new file mode 100644
index 0000000..c5abc1d
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
@@ -0,0 +1,279 @@
+/*
+ * 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.enduser;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.MediaType;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.SyncopeTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.rest.api.service.SyncopeService;
+import org.apache.wicket.Session;
+import org.apache.wicket.protocol.http.WebSession;
+import org.apache.wicket.request.Request;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Custom Syncope Enduser Session class.
+ */
+public class SyncopeEnduserSession extends WebSession {
+
+ private static final long serialVersionUID = 1284946129513378647L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(SyncopeEnduserSession.class);
+
+ public static final List<Locale> SUPPORTED_LOCALES = Arrays.asList(new Locale[] {
+ Locale.ENGLISH, Locale.ITALIAN, new Locale("pt", "BR") });
+
+ protected static final String ENDUSER_PROPERTIES = "enduser.properties";
+
+ private String username;
+
+ private String password;
+
+ private String scheme;
+
+ private String host;
+
+ private String port;
+
+ private String rootPath;
+
+ private String anonymousUser;
+
+ private String anonymousKey;
+
+ private Boolean storePassword;
+
+ private String version;
+
+ private String license;
+
+ private final SyncopeClientFactoryBean clientFactory;
+
+ private SyncopeClient client;
+
+ private final SyncopeClient anonymousClient;
+
+ private final SyncopeTO syncopeTO;
+
+ private UserTO selfTO;
+
+ private final Map<Class<?>, Object> services = Collections.synchronizedMap(new HashMap<Class<?>, Object>());
+
+ public static SyncopeEnduserSession get() {
+ return (SyncopeEnduserSession) Session.get();
+ }
+
+ public SyncopeEnduserSession(final Request request) {
+ super(request);
+
+ // load properties from classpath file
+ loadProperties();
+
+ clientFactory = new SyncopeClientFactoryBean();
+ clientFactory.setAddress(new StringBuilder(scheme)
+ .append("://")
+ .append(host)
+ .append(":")
+ .append(port)
+ .append("/")
+ .append(rootPath)
+ .toString());
+ clientFactory.setContentType(SyncopeClientFactoryBean.ContentType.JSON);
+
+ anonymousClient = clientFactory.create(anonymousUser, anonymousKey);
+ syncopeTO = anonymousClient.getService(SyncopeService.class).info();
+
+ }
+
+ public boolean authenticate(final String username, final String password) {
+ boolean authenticated = false;
+
+ try {
+ client = clientFactory.setDomain(SyncopeConstants.MASTER_DOMAIN).create(username, password);
+
+ Pair<Map<String, Set<String>>, UserTO> self = client.self();
+ selfTO = self.getValue();
+
+ this.username = username;
+ this.password = password;
+ // bind explicitly this session to have a stateful behavior during http requests, unless session will expire
+ // for every request
+ this.bind();
+ authenticated = true;
+ } catch (Exception e) {
+ LOG.error("Authentication failed", e);
+ }
+
+ return authenticated;
+ }
+
+ public <T> void resetClient(final Class<T> service) {
+ T serviceInstance = getCachedService(service);
+ WebClient.client(serviceInstance).reset();
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T getCachedService(final Class<T> serviceClass) {
+ T service;
+ if (services.containsKey(serviceClass)) {
+ service = (T) services.get(serviceClass);
+ } else {
+ service = client == null ? anonymousClient.getService(serviceClass) : client.getService(serviceClass);
+ services.put(serviceClass, service);
+ }
+
+ return service;
+ }
+
+ public <T> T getService(final Class<T> serviceClass) {
+ return getCachedService(serviceClass);
+ }
+
+ public <T> T getService(final String etag, final Class<T> serviceClass) {
+ T serviceInstance = getCachedService(serviceClass);
+ WebClient.client(serviceInstance).match(new EntityTag(etag), false).
+ type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
+
+ return serviceInstance;
+ }
+
+ public <T> T getService(final MediaType mediaType, final Class<T> serviceClass) {
+ T service;
+
+ synchronized (clientFactory) {
+ SyncopeClientFactoryBean.ContentType preType = clientFactory.getContentType();
+
+ clientFactory.setContentType(SyncopeClientFactoryBean.ContentType.fromString(mediaType.toString()));
+ service = clientFactory.create(username, password).getService(serviceClass);
+ clientFactory.setContentType(preType);
+ }
+
+ return service;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getScheme() {
+ return scheme;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public String getRootPath() {
+ return rootPath;
+ }
+
+ public String getAnonymousUser() {
+ return anonymousUser;
+ }
+
+ public String getAnonymousKey() {
+ return anonymousKey;
+ }
+
+ public Boolean storePassword() {
+ return this.storePassword;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getLicense() {
+ return license;
+ }
+
+ public SyncopeTO getSyncopeTO() {
+ return syncopeTO;
+ }
+
+ public UserTO getSelfTO() {
+ return selfTO;
+ }
+
+ public boolean isAuthenticated() {
+ return getUsername() != null;
+ }
+
+ public DateFormat getDateFormat() {
+ final Locale locale = getLocale() == null ? Locale.ENGLISH : getLocale();
+
+ return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale);
+ }
+
+ private void loadProperties() {
+ Properties properties = new Properties();
+
+ try {
+ properties.load(getClass().getResourceAsStream("/" + ENDUSER_PROPERTIES));
+ File enduserDir = new File(properties.getProperty("enduser.directory"));
+ if (enduserDir.exists() && enduserDir.canRead() && enduserDir.isDirectory()) {
+ File enduserDirProps = FileUtils.getFile(enduserDir, ENDUSER_PROPERTIES);
+ if (enduserDirProps.exists() && enduserDirProps.canRead() && enduserDirProps.isFile()) {
+ properties.clear();
+ properties.load(FileUtils.openInputStream(enduserDir));
+ }
+ }
+ } catch (Exception e) {
+ LOG.error("Error loading {} file", ENDUSER_PROPERTIES, e);
+// throw new WicketRuntimeException("Could not read " + ENDUSER_PROPERTIES, e);
+ }
+
+ this.scheme = properties.getProperty("scheme");
+ this.host = properties.getProperty("host");
+ this.port = properties.getProperty("port");
+ this.rootPath = properties.getProperty("rootPath");
+ this.anonymousUser = properties.getProperty("anonymousUser");
+ this.anonymousKey = properties.getProperty("anonymousKey");
+ this.storePassword = Boolean.valueOf(properties.getProperty("storePassword"));
+ version = properties.getProperty("version");
+ license = properties.getProperty("license");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java
new file mode 100644
index 0000000..551555f
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/adapters/UserTOAdapter.java
@@ -0,0 +1,78 @@
+/*
+ * 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.enduser.adapters;
+
+import org.apache.syncope.client.enduser.model.UserTORequest;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserTOAdapter {
+
+ private static final Logger LOG = LoggerFactory.getLogger(UserTOAdapter.class);
+
+ public UserTO fromUserTORequest(final UserTORequest userTORequest, final String oldSelfPassword) {
+
+ // adapter code, to be moved in a new utility class
+ final UserTO userTO = new UserTO();
+ // set key if in update mode
+ final Long key = userTORequest.getKey();
+ if (key != null) {
+ userTO.setKey(key);
+ }
+ // set username...
+ userTO.setUsername(userTORequest.getUsername());
+ // ...and password
+ String requestPassword = userTORequest.getPassword();
+ if (requestPassword == null || requestPassword.isEmpty()) {
+ userTO.setPassword(oldSelfPassword == null ? null : oldSelfPassword);
+ } else {
+ userTO.setPassword(requestPassword);
+ }
+
+ //set security question and answer
+ userTO.setSecurityQuestion(userTORequest.getSecurityQuestion());
+ userTO.setSecurityAnswer(userTORequest.getSecurityAnswer());
+ //set realm
+ userTO.setRealm(userTORequest.getRealm());
+ // add attributes
+ userTO.getPlainAttrs().addAll(userTORequest.getPlainAttrs().values());
+ userTO.getDerAttrs().addAll(userTORequest.getDerAttrs().values());
+ userTO.getVirAttrs().addAll(userTORequest.getVirAttrs().values());
+
+ return userTO;
+ }
+
+ public UserTORequest toUserTORequest(final UserTO userTO) {
+
+ final UserTORequest userTORequest = new UserTORequest().
+ key(userTO.getKey()).
+ username(userTO.getUsername()).
+ securityQuestion(userTO.getSecurityQuestion()).
+ securityAnswer(userTO.getSecurityAnswer()).
+ realm(userTO.getRealm());
+
+ userTORequest.getPlainAttrs().putAll(userTO.getPlainAttrMap());
+ userTORequest.getDerAttrs().putAll(userTO.getDerAttrMap());
+ userTORequest.getVirAttrs().putAll(userTO.getVirAttrMap());
+
+ return userTORequest;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/Credentials.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/Credentials.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/Credentials.java
new file mode 100644
index 0000000..68e3106
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/Credentials.java
@@ -0,0 +1,65 @@
+/*
+ * 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.enduser.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Credentials {
+
+ private String username;
+
+ private String password;
+
+ public Credentials() {
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(final String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+
+ public Credentials username(final String username) {
+ this.username = username;
+ return this;
+ }
+
+ public Credentials password(final String password) {
+ this.password = password;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
new file mode 100644
index 0000000..912f287
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/SchemaResponse.java
@@ -0,0 +1,79 @@
+/*
+ * 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.enduser.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
+
+public class SchemaResponse implements Serializable {
+
+ private static final long serialVersionUID = -8896862106241712829L;
+
+ private List<PlainSchemaTO> plainSchemas = new ArrayList<>();
+
+ private List<DerSchemaTO> derSchemas = new ArrayList<>();
+
+ private List<VirSchemaTO> virSchemas = new ArrayList<>();
+
+ public SchemaResponse() {
+ }
+
+ public List<PlainSchemaTO> getPlainSchemas() {
+ return plainSchemas;
+ }
+
+ public void setPlainSchemas(final List<PlainSchemaTO> plainSchemas) {
+ this.plainSchemas = plainSchemas;
+ }
+
+ public List<DerSchemaTO> getDerSchemas() {
+ return derSchemas;
+ }
+
+ public void setDerSchemas(final List<DerSchemaTO> derSchemas) {
+ this.derSchemas = derSchemas;
+ }
+
+ public List<VirSchemaTO> getVirSchemas() {
+ return virSchemas;
+ }
+
+ public void setVirSchemas(final List<VirSchemaTO> virSchemas) {
+ this.virSchemas = virSchemas;
+ }
+
+ public SchemaResponse plainSchemas(final List<PlainSchemaTO> value) {
+ this.plainSchemas = value;
+ return this;
+ }
+
+ public SchemaResponse derSchemas(final List<DerSchemaTO> value) {
+ this.derSchemas = value;
+ return this;
+ }
+
+ public SchemaResponse virSchemas(final List<VirSchemaTO> value) {
+ this.virSchemas = value;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java
new file mode 100644
index 0000000..09bc219
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/UserTORequest.java
@@ -0,0 +1,174 @@
+/*
+ * 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.enduser.model;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.syncope.common.lib.to.AttrTO;
+
+public class UserTORequest implements Serializable {
+
+ private static final long serialVersionUID = -6763020920564016374L;
+
+ private Long key;
+
+ private String username;
+
+ private String password;
+
+ private Long securityQuestion;
+
+ private String securityAnswer;
+
+ private String realm;
+
+ private Map<String, AttrTO> plainAttrs = new HashMap<>();
+
+ private Map<String, AttrTO> derAttrs = new HashMap<>();
+
+ private Map<String, AttrTO> virAttrs = new HashMap<>();
+
+ public UserTORequest() {
+ }
+
+ public Long getKey() {
+ return key;
+ }
+
+ public void setKey(final Long key) {
+ this.key = key;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(final String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+
+ public Long getSecurityQuestion() {
+ return securityQuestion;
+ }
+
+ public void setSecurityQuestion(final Long securityQuestion) {
+ this.securityQuestion = securityQuestion;
+ }
+
+ public String getSecurityAnswer() {
+ return securityAnswer;
+ }
+
+ public void setSecurityAnswer(final String securityAnswer) {
+ this.securityAnswer = securityAnswer;
+ }
+
+ public String getRealm() {
+ return realm;
+ }
+
+ public void setRealm(final String realm) {
+ this.realm = realm;
+ }
+
+ public Map<String, AttrTO> getPlainAttrs() {
+ return plainAttrs;
+ }
+
+ public void setPlainAttrs(final Map<String, AttrTO> plainAttrs) {
+ this.plainAttrs = plainAttrs;
+ }
+
+ public Map<String, AttrTO> getDerAttrs() {
+ return derAttrs;
+ }
+
+ public void setDerAttrs(final Map<String, AttrTO> derAttrs) {
+ this.derAttrs = derAttrs;
+ }
+
+ public Map<String, AttrTO> getVirAttrs() {
+ return virAttrs;
+ }
+
+ public void setVirAttrs(final Map<String, AttrTO> virAttrs) {
+ this.virAttrs = virAttrs;
+ }
+
+ public UserTORequest key(final Long value) {
+ this.key = value;
+ return this;
+ }
+
+ public UserTORequest username(final String value) {
+ this.username = value;
+ return this;
+ }
+
+ public UserTORequest password(final String value) {
+ this.password = value;
+ return this;
+ }
+
+ public UserTORequest securityQuestion(final Long value) {
+ this.securityQuestion = value;
+ return this;
+ }
+
+ public UserTORequest securityAnswer(final String value) {
+ this.securityAnswer = value;
+ return this;
+ }
+
+ public UserTORequest realm(final String value) {
+ this.realm = value;
+ return this;
+ }
+
+ public UserTORequest plainAttrs(final Map<String, AttrTO> value) {
+ this.plainAttrs = value;
+ return this;
+ }
+
+ public UserTORequest derAttrs(final Map<String, AttrTO> value) {
+ this.derAttrs = value;
+ return this;
+ }
+
+ public UserTORequest virAttrs(final Map<String, AttrTO> value) {
+ this.virAttrs = value;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/pages/HomePage.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/pages/HomePage.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/pages/HomePage.java
new file mode 100644
index 0000000..4c5c07e
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/pages/HomePage.java
@@ -0,0 +1,35 @@
+/*
+ * 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.enduser.pages;
+
+import org.apache.wicket.NonResettingRestartException;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+public class HomePage extends WebPage {
+
+ private static final long serialVersionUID = -3422492668689122688L;
+
+ public HomePage(final PageParameters parameters) {
+ super(parameters);
+// throw new RedirectToUrlException("/app/");
+ throw new NonResettingRestartException("/app/");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AbstractBaseResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AbstractBaseResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AbstractBaseResource.java
new file mode 100644
index 0000000..a3aedfc
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AbstractBaseResource.java
@@ -0,0 +1,58 @@
+/*
+ * 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.enduser.resources;
+
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.wicket.request.resource.AbstractResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractBaseResource extends AbstractResource {
+
+ private static final long serialVersionUID = -7875801358718612782L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractBaseResource.class);
+
+ protected <T> T getService(final Class<T> serviceClass) {
+ return SyncopeEnduserSession.get().getService(serviceClass);
+ }
+
+ protected <T> T getService(final String etag, final Class<T> serviceClass) {
+ return SyncopeEnduserSession.get().getService(etag, serviceClass);
+ }
+
+ protected <T> void resetClient(final Class<T> serviceClass) {
+ SyncopeEnduserSession.get().resetClient(serviceClass);
+ }
+
+ protected boolean isSelfRegistrationAllowed() {
+ Boolean result = null;
+ try {
+ result = SyncopeEnduserSession.get().getSyncopeTO().isSelfRegAllowed();
+ } catch (SyncopeClientException e) {
+ LOG.error("While seeking if self registration is allowed", e);
+ }
+
+ return result == null
+ ? false
+ : result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ErrorResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ErrorResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ErrorResource.java
new file mode 100644
index 0000000..bfceeab
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ErrorResource.java
@@ -0,0 +1,50 @@
+/*
+ * 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.enduser.resources;
+
+import javax.ws.rs.core.MediaType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Mirror REST resource for obtaining user self operations.
+ *
+ * @see org.apache.syncope.common.rest.api
+ */
+public class ErrorResource extends AbstractBaseResource {
+
+ private static final long serialVersionUID = -9184809392631523912L;
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(ErrorResource.class);
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+
+ ResourceResponse response = new ResourceResponse();
+ response.disableCaching();
+ response.setContentType(MediaType.APPLICATION_JSON);
+
+ response.setStatusCode(403);
+
+ return response;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
new file mode 100644
index 0000000..fa6fa8c
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
@@ -0,0 +1,84 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.enduser.model.Credentials;
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.wicket.util.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LoginResource extends AbstractBaseResource {
+
+ private static final long serialVersionUID = -7720997467070461915L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(LoginResource.class);
+
+ public LoginResource() {
+ }
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+
+ int responseStatus;
+ final String responseMessage;
+ ResourceResponse response = new ResourceResponse();
+
+ try {
+ HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
+ Credentials credentials = POJOHelper.deserialize(IOUtils.toString(request.getInputStream()),
+ Credentials.class);
+ final String username = credentials.getUsername();
+ final String password = credentials.getPassword().isEmpty() ? null : credentials.getPassword();
+
+ LOG.debug("Enduser login, user: {}", username);
+
+ if (StringUtils.isBlank(username)) {
+ LOG.error("Could not read credentials from request: username is blank!");
+ responseMessage = "Could not read credentials from request: username is blank!";
+ responseStatus = 400;
+ } else {
+ // authenticate user
+ final boolean authenticated = SyncopeEnduserSession.get().authenticate(username, password);
+ responseStatus = authenticated ? 200 : 401;
+ responseMessage = username;
+ }
+
+ response.setWriteCallback(new WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(responseMessage);
+ }
+ });
+
+ } catch (Exception e) {
+ responseStatus = 400;
+ LOG.error("Could not read credentials from request", e);
+ }
+
+ response.setStatusCode(responseStatus);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
new file mode 100644
index 0000000..545b44d
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LogoutResource.java
@@ -0,0 +1,43 @@
+/*
+ * 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.enduser.resources;
+
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LogoutResource extends AbstractBaseResource {
+
+ private static final long serialVersionUID = -648841355644985051L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(LogoutResource.class);
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+
+ LOG.debug("Enduser logout");
+
+ SyncopeEnduserSession.get().invalidate();
+
+ ResourceResponse response = new ResourceResponse();
+ response.setStatusCode(204);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
new file mode 100644
index 0000000..544138b
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -0,0 +1,116 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.syncope.client.enduser.model.SchemaResponse;
+import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
+import org.apache.syncope.common.rest.api.service.AnyTypeService;
+import org.apache.syncope.common.rest.api.service.SchemaService;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.wicket.request.resource.AbstractResource;
+import org.apache.wicket.request.resource.IResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SchemaResource extends AbstractBaseResource {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SchemaResource.class);
+
+ private static final long serialVersionUID = 6453101466981543020L;
+
+ private final AnyTypeService anyTypeService;
+
+ private final AnyTypeClassService anyTypeClassService;
+
+ private final SchemaService schemaService;
+
+ public SchemaResource() {
+ anyTypeService = getService(AnyTypeService.class);
+ anyTypeClassService = getService(AnyTypeClassService.class);
+ schemaService = getService(SchemaService.class);
+ }
+
+ @Override
+ protected AbstractResource.ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
+
+ AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();
+
+ int responseStatus = 200;
+
+ try {
+
+ final AnyTypeTO anyTypeUserTO = anyTypeService.read(AnyTypeKind.USER.name());
+
+ final List<PlainSchemaTO> plainSchemas = new ArrayList<>();
+ final List<DerSchemaTO> derSchemas = new ArrayList<>();
+ final List<VirSchemaTO> virSchemas = new ArrayList<>();
+
+ // read all USER type schemas
+ for (String clazz : anyTypeUserTO.getClasses()) {
+ plainSchemas.addAll(getSchemaTOs(anyTypeClassService.read(clazz).getPlainSchemas(), SchemaType.PLAIN,
+ PlainSchemaTO.class));
+ derSchemas.addAll(getSchemaTOs(anyTypeClassService.read(clazz).getDerSchemas(), SchemaType.DERIVED,
+ DerSchemaTO.class));
+ virSchemas.addAll(getSchemaTOs(anyTypeClassService.read(clazz).getVirSchemas(), SchemaType.VIRTUAL,
+ VirSchemaTO.class));
+ }
+
+ response.setWriteCallback(new AbstractResource.WriteCallback() {
+
+ @Override
+ public void writeData(final IResource.Attributes attributes) throws IOException {
+ attributes.getResponse().write(POJOHelper.serialize(new SchemaResponse().
+ plainSchemas(plainSchemas).
+ derSchemas(derSchemas).
+ virSchemas(virSchemas)));
+ }
+ });
+
+ } catch (Exception e) {
+ LOG.error("Error retrieving " + AnyTypeKind.USER.name() + " class schemas", e);
+ responseStatus = 400;
+ }
+
+ response.setStatusCode(responseStatus);
+ return response;
+ }
+
+ private <T extends AbstractSchemaTO> List<T> getSchemaTOs(final List<String> schemaNames,
+ final SchemaType schemaType, final Class<T> type) {
+
+ List<T> schemaTOs = new ArrayList<>();
+
+ for (String schemaName : schemaNames) {
+ schemaTOs.add(type.cast(schemaService.read(schemaType, schemaName)));
+ }
+
+ return schemaTOs;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
new file mode 100644
index 0000000..f1ab6c8
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
@@ -0,0 +1,73 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.syncope.common.lib.to.SecurityQuestionTO;
+import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.wicket.request.resource.AbstractResource;
+import org.apache.wicket.request.resource.IResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SecurityQuestionResource extends AbstractBaseResource {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SecurityQuestionResource.class);
+
+ private static final long serialVersionUID = 6453101466981543020L;
+
+ private final SecurityQuestionService securityQuestionService;
+
+ public SecurityQuestionResource() {
+ securityQuestionService = getService(SecurityQuestionService.class);
+ }
+
+ @Override
+ protected AbstractResource.ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
+
+ AbstractResource.ResourceResponse response = new AbstractResource.ResourceResponse();
+
+ int responseStatus = 200;
+
+ try {
+
+ LOG.debug("List available security questions");
+
+ final List<SecurityQuestionTO> securityQuestionTOs = securityQuestionService.list();
+
+ response.setWriteCallback(new AbstractResource.WriteCallback() {
+
+ @Override
+ public void writeData(final IResource.Attributes attributes) throws IOException {
+ attributes.getResponse().write(POJOHelper.serialize(securityQuestionTOs));
+ }
+ });
+
+ } catch (Exception e) {
+ LOG.error("Error retrieving security questions", e);
+ responseStatus = 400;
+ }
+
+ response.setStatusCode(responseStatus);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
new file mode 100644
index 0000000..61734a7
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
@@ -0,0 +1,97 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.client.enduser.adapters.UserTOAdapter;
+import org.apache.syncope.client.enduser.model.UserTORequest;
+import org.apache.syncope.common.rest.api.service.UserSelfService;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.wicket.util.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserSelfCreateResource extends AbstractBaseResource {
+
+ private static final long serialVersionUID = -2721621682300247583L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(UserSelfCreateResource.class);
+
+ private final UserSelfService userSelfService;
+
+ private final UserTOAdapter userTOAdapter;
+
+ public UserSelfCreateResource() {
+ userTOAdapter = new UserTOAdapter();
+ userSelfService = getService(UserSelfService.class);
+ }
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+
+ int responseStatus = 200;
+ final StringBuilder responseMessage = new StringBuilder();
+ ResourceResponse response = new ResourceResponse();
+
+ try {
+ HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
+
+ final UserTORequest userTORequest = POJOHelper.deserialize(IOUtils.toString(request.getInputStream()),
+ UserTORequest.class);
+
+ if (isSelfRegistrationAllowed() && userTORequest != null) {
+ LOG.debug("Received user self registration request for user: [{}]", userTORequest.getUsername());
+ LOG.trace("Received user self registration request is: [{}]", userTORequest);
+ // adapt request and create user
+ userSelfService.create(userTOAdapter.fromUserTORequest(userTORequest, null),
+ SyncopeEnduserSession.get().storePassword());
+ responseMessage.append("User").append(userTORequest.getUsername()).append("created successfully");
+ } else {
+ responseMessage.append(userTORequest == null
+ ? "Request received is not valid"
+ : "Self registration not allowed");
+ responseStatus = 403;
+ }
+ response.setWriteCallback(new WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(responseMessage);
+ }
+ });
+
+ } catch (final Exception e) {
+ responseStatus = 400;
+ response.setWriteCallback(new WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(e.getMessage());
+ }
+ });
+ LOG.error("Could not read userTO from request", e);
+ }
+
+ response.setStatusCode(responseStatus);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
new file mode 100644
index 0000000..3519e78
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -0,0 +1,66 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.client.enduser.adapters.UserTOAdapter;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.wicket.request.resource.AbstractResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Mirror REST resource for obtaining user self operations.
+ *
+ * @see org.apache.syncope.common.rest.api
+ */
+public class UserSelfReadResource extends AbstractResource {
+
+ private static final long serialVersionUID = -9184809392631523912L;
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(UserSelfReadResource.class);
+
+ private final UserTOAdapter userTOAdapter;
+
+ public UserSelfReadResource() {
+ userTOAdapter = new UserTOAdapter();
+ }
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+
+ ResourceResponse response = new ResourceResponse();
+ final String selfTOJson = POJOHelper.serialize(userTOAdapter.toUserTORequest(SyncopeEnduserSession.get().
+ getSelfTO()));
+
+ response.setWriteCallback(new WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(selfTOJson);
+ }
+ });
+
+ return response;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
new file mode 100644
index 0000000..5fc9c82
--- /dev/null
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
@@ -0,0 +1,96 @@
+/*
+ * 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.enduser.resources;
+
+import java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.client.enduser.adapters.UserTOAdapter;
+import org.apache.syncope.client.enduser.model.UserTORequest;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.rest.api.service.UserSelfService;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+import org.apache.wicket.util.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class UserSelfUpdateResource extends AbstractBaseResource {
+
+ private static final long serialVersionUID = -2721621682300247583L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(UserSelfUpdateResource.class);
+
+ private final UserSelfService userSelfService;
+
+ private final UserTOAdapter userTOAdapter;
+
+ public UserSelfUpdateResource() {
+ userTOAdapter = new UserTOAdapter();
+ userSelfService = getService(UserSelfService.class);
+ }
+
+ @Override
+ protected ResourceResponse newResourceResponse(final Attributes attributes) {
+
+ int responseStatus = 200;
+ final String responseMessage;
+ ResourceResponse response = new ResourceResponse();
+
+ try {
+ HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
+
+ final UserTORequest userTOResponse = POJOHelper.deserialize(IOUtils.toString(request.getInputStream()),
+ UserTORequest.class);
+
+ LOG.debug("userTOResponse: {}", userTOResponse);
+
+ // adapt user, change self password only value passed is not null and has changed
+ UserTO userTO = userTOAdapter.fromUserTORequest(userTOResponse, SyncopeEnduserSession.get().getPassword());
+
+ LOG.debug("Enduser user self update, user: {}", userTO.toString());
+
+ // update user
+ userSelfService.update(userTO);
+ responseMessage = "User updated successfully";
+
+ response.setWriteCallback(new WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(responseMessage);
+ }
+ });
+
+ } catch (final Exception e) {
+ responseStatus = 400;
+ response.setWriteCallback(new WriteCallback() {
+
+ @Override
+ public void writeData(final Attributes attributes) throws IOException {
+ attributes.getResponse().write(e.getMessage());
+ }
+ });
+ LOG.error("Could not read userTO from request", e);
+ }
+
+ response.setStatusCode(responseStatus);
+ return response;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/app.css b/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
new file mode 100644
index 0000000..e5ae8e5
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/app.css
@@ -0,0 +1,28 @@
+/*
+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.
+*/
+
+/* app general css stylesheet */
+
+.growl-container > .growl-item.ng-enter,
+.growl-container > .growl-item.ng-leave {
+ -webkit-transition:1s linear all;
+ -moz-transition:1s linear all;
+ -o-transition:1s linear all;
+ transition:1s linear all;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css b/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
new file mode 100644
index 0000000..ee13bd0
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/editUser.css
@@ -0,0 +1,253 @@
+/*
+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.
+*/
+
+#form-container {
+ position: relative;
+ width: 100%;
+ margin: 0 auto;
+ text-align: center;
+}
+
+#form-container .page-header { background: -moz-linear-gradient(top, #a9db80 0%, #96c56f 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9db80), color-stop(100%,#96c56f)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* IE10+ */
+ margin: 1% 16%;
+ width: 72%; padding:10px;
+ /* shadows and rounded borders */
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
+ -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
+ box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
+}
+#form-container .breadcrumb-header {
+ margin: 1% 16%;
+ width: 72%; padding:10px;
+}
+
+.signup-form {
+ text-align: left;
+ padding: 2%;
+}
+
+#attribute {
+ padding: 0 255px;
+}
+
+#attribute-derived,
+#attribute-virtual {
+ padding: 0 155px;
+}
+
+.attribute-virtual-value-container {
+ margin-top: 2%;
+ list-style: none;
+ padding-right: 5%;
+}
+
+.attribute-virtual-value-field {
+ font-weight: 700;
+ padding: 6px 12px;
+ margin-bottom: 2%;
+}
+
+.minus{
+ margin-bottom: 2%;
+}
+
+.fileButton{
+ margin-top: 2%;
+}
+
+.upper-select {
+ padding-right: 71%;
+ padding-left: 18%;
+}
+
+.attribute-ui-select {
+ width: 100%;
+ padding-right: 7%;
+ padding-left: 7%;
+}
+
+#previous {
+ background: -moz-linear-gradient(top, #a9db80 0%, #96c56f 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9db80), color-stop(100%,#96c56f)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* IE10+ */
+ float: left;
+ color: black;
+ width: 30%;
+}
+#previous:hover {
+ background: #658D5D;
+}
+
+#next{
+ background: -moz-linear-gradient(top, #a9db80 0%, #96c56f 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9db80), color-stop(100%,#96c56f)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* IE10+ */
+ margin-top: 5px;
+ float: right;
+ color: black;
+ width: 30%;
+}
+#next:hover {
+ background: #658D5D;
+}
+
+#save{
+ background: -moz-linear-gradient(top, #a9db80 0%, #96c56f 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9db80), color-stop(100%,#96c56f)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* IE10+ */
+ color: black;
+ margin-top: 5%;
+ width: 15%;
+}
+#save:hover {
+ background: #658D5D;
+}
+#cancel {
+ margin-top: 5%;
+ width: 15%;
+}
+
+#form-views { width:auto; }
+
+/* basic styling for entering and leaving */
+/* left and right to add to ensure full width: position:absolute; left:30px; right:30px; */
+#form-views.ng-enter,
+#form-views.ng-leave {
+ transition:0.5s all ease; -moz-transition:0.5s all ease; -webkit-transition:0.5s all ease;
+}
+
+/* enter animation */
+#form-views.ng-enter {
+ -webkit-animation:slideInRight 0.5s both ease;
+ -moz-animation:slideInRight 0.5s both ease;
+ animation:slideInRight 0.5s both ease;
+}
+
+/* leave animation */
+#form-views.ng-leave {
+ -webkit-animation:slideOutLeft 0.5s both ease;
+ -moz-animation:slideOutLeft 0.5s both ease;
+ animation:slideOutLeft 0.5s both ease;
+}
+
+/** Button breadcrumb **/
+.btn-breadcrumb .btn:not(:last-child):after {
+ content: " ";
+ display: block;
+ width: 0;
+ height: 0;
+ border-top: 17px solid transparent;
+ border-bottom: 17px solid transparent;
+ border-left: 10px solid white;
+ position: absolute;
+ top: 50%;
+ margin-top: -17px;
+ left: 100%;
+ z-index: 3;
+}
+.btn-breadcrumb .btn:not(:last-child):before {
+ content: " ";
+ display: block;
+ width: 0;
+ height: 0;
+ border-top: 17px solid transparent;
+ border-bottom: 17px solid transparent;
+ border-left: 10px solid rgb(173, 173, 173);
+ position: absolute;
+ top: 50%;
+ margin-top: -17px;
+ margin-left: 1px;
+ left: 100%;
+ z-index: 3;
+}
+
+/** The Spacing **/
+.btn-breadcrumb .btn {
+ padding:6px 12px 6px 24px;
+}
+.btn-breadcrumb .btn:first-child {
+ padding:6px 6px 6px 10px;
+}
+.btn-breadcrumb .btn:last-child {
+ padding:6px 18px 6px 24px;
+}
+
+/** Default button **/
+.btn-breadcrumb .btn.btn-default:not(:last-child):after {
+ border-left: 10px solid #fff;
+}
+.btn-breadcrumb .btn.btn-default:not(:last-child):before {
+ border-left: 10px solid #ccc;
+}
+.btn-breadcrumb .btn.btn-default:hover:not(:last-child):after {
+ border-left: 10px solid #ebebeb;
+}
+.btn-breadcrumb .btn.btn-default:hover:not(:last-child):before {
+ border-left: 10px solid #adadad;
+}
+
+.breadcrumb-disabled-link {
+ pointer-events: none;
+ cursor: default;
+}
+
+.text-validation-error{
+ color: #dd301b;
+ font-weight: 600;
+}
+/* ANIMATIONS
+============================================================================= */
+/* slide out to the left */
+@keyframes slideOutLeft {
+ to { transform: translateX(-200%); }
+}
+@-moz-keyframes slideOutLeft {
+ to { -moz-transform: translateX(-200%); }
+}
+@-webkit-keyframes slideOutLeft {
+ to { -webkit-transform: translateX(-200%); }
+}
+
+/* slide in from the right */
+@keyframes slideInRight {
+ from { transform:translateX(200%); }
+ to { transform: translateX(0); }
+}
+@-moz-keyframes slideInRight {
+ from { -moz-transform:translateX(200%); }
+ to { -moz-transform: translateX(0); }
+}
+@-webkit-keyframes slideInRight {
+ from { -webkit-transform:translateX(200%); }
+ to { -webkit-transform: translateX(0); }
+}
+
http://git-wip-us.apache.org/repos/asf/syncope/blob/223a64e2/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/resources/META-INF/resources/app/css/login.css b/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
new file mode 100644
index 0000000..fdc9e3e
--- /dev/null
+++ b/client/enduser/src/main/resources/META-INF/resources/app/css/login.css
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+body, html {
+ margin: 45px 0;
+ height: 100%;
+ background-repeat: no-repeat;
+ /*background-image: linear-gradient(rgb(104, 145, 162), #00a65a);*/
+ background-color: #EEEEEE;
+}
+#login-container {
+ position: relative;
+ width: 100%;
+ margin: 0 auto;
+ text-align: center;
+ background-color: #FFF;
+ border-top-right-radius: 4px;
+ border-top-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-bottom-left-radius: 4px;
+ -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.65);
+ box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.65);
+}
+#login-container .row > div {
+ margin-bottom: 1em;
+}
+#login-container .row > div:last-child {
+ margin-bottom: 0;
+}
+#login-container #logo {
+ position: relative;
+ float: left;
+ margin-left: 15%;
+ border-top-right-radius: 100px;
+ border-top-left-radius: 100px;
+ border-bottom-right-radius: 100px;
+ border-bottom-left-radius: 100px;
+}
+
+#login-container #language{
+ padding: 0px;
+ height: 40px;
+}
+
+#login-container #signup-btn {
+ padding-top: 15px;
+ padding-bottom: 15px;
+}
+#login-container #signup-btn:hover {
+ background-color: #1d1d1d;
+ border-color: #181818;
+}
+
+.login-btn {
+ background: -moz-linear-gradient(top, #a9db80 0%, #96c56f 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9db80), color-stop(100%,#96c56f)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* Opera 11.10+ */
+ background: -ms-linear-gradient(top, #a9db80 0%,#96c56f 100%); /* IE10+ */
+ margin-top: 5px;
+ color: black;
+}
+.login-btn:hover {
+ background: #658D5D;
+}
+
+#login {
+ position: relative;
+ padding: 25px 25px 50px 25px;
+ margin-bottom: 1em;
+}
+#login #login-form {
+ margin-top: 2em;
+ margin-bottom: 2em;
+ text-align: left;
+}
+#login-form{
+ padding: 0 195px;
+ margin: 7%;
+}
+#languageContainer {
+ padding: 0 25px;
+}
+
+.logout{
+ float: right;
+}
\ No newline at end of file
[20/50] [abbrv] syncope git commit: [SYNCOPE-717] Improving test case
Posted by fm...@apache.org.
[SYNCOPE-717] Improving test case
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d404b400
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d404b400
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d404b400
Branch: refs/heads/SYNCOPE-156
Commit: d404b400ad4b37d5bb4e2b6aa9f0d9c164822250
Parents: 5954e2e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Oct 29 10:19:31 2015 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Oct 29 10:19:31 2015 +0100
----------------------------------------------------------------------
.../org/apache/syncope/core/rest/RoleTestITCase.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d404b400/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
index ce553cc..5b18f3e 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/RoleTestITCase.java
@@ -928,5 +928,19 @@ public class RoleTestITCase extends AbstractTest {
roleTO = updateRole(roleMod);
assertNotNull(roleTO);
assertEquals("11.257", roleTO.getAttrMap().get(doubleSchemaName).getValues().get(0));
+
+ // 6. update schema, unset conversion pattern
+ schema.setConversionPattern(null);
+ schemaService.update(AttributableType.ROLE, SchemaType.NORMAL, schema.getName(), schema);
+
+ // 7. modify role with new double value, verify that no pattern is applied
+ roleMod = new RoleMod();
+ roleMod.setId(roleTO.getId());
+ roleMod.getAttrsToRemove().add(doubleSchemaName);
+ roleMod.getAttrsToUpdate().add(attributeMod(doubleSchemaName, "11.23"));
+
+ roleTO = updateRole(roleMod);
+ assertNotNull(roleTO);
+ assertEquals("11.23", roleTO.getAttrMap().get(doubleSchemaName).getValues().get(0));
}
}