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:35:21 UTC
[42/50] [abbrv] syncope git commit: added details option, SYNCOPE-158
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"),