Repository: syncope Updated Branches: refs/heads/master e486aaf3a -> 6d368c8b2
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() { }
