Repository: syncope Updated Branches: refs/heads/master 0892af815 -> 26a4cd26c
Added group command, SYNCOPE-158 Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/26a4cd26 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/26a4cd26 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/26a4cd26 Branch: refs/heads/master Commit: 26a4cd26cc8c355f7ae951ae2455d117cd0f31fd Parents: 0892af8 Author: massi <[email protected]> Authored: Mon Nov 2 15:21:18 2015 +0100 Committer: massi <[email protected]> Committed: Mon Nov 2 15:21:18 2015 +0100 ---------------------------------------------------------------------- .../org/apache/syncope/client/cli/Input.java | 8 +- .../cli/commands/CommonsResultManager.java | 2 +- .../configuration/ConfigurationCommand.java | 2 +- .../commands/connector/ConnectorCommand.java | 2 +- .../entitlement/EntitlementCommand.java | 2 +- .../commands/group/AbstractGroupCommand.java | 27 ++++ .../client/cli/commands/group/GroupCommand.java | 124 +++++++++++++++++++ .../client/cli/commands/group/GroupDelete.java | 59 +++++++++ .../client/cli/commands/group/GroupDetails.java | 78 ++++++++++++ .../client/cli/commands/group/GroupList.java | 50 ++++++++ .../client/cli/commands/group/GroupRead.java | 58 +++++++++ ...pReadAttributeBySchemaTypeAndSchemaName.java | 61 +++++++++ .../group/GroupReadAttributesBySchemaType.java | 64 ++++++++++ .../cli/commands/group/GroupResultManager.java | 85 +++++++++++++ .../commands/group/GroupSyncopeOperations.java | 63 ++++++++++ .../client/cli/commands/help/HelpCommand.java | 2 +- .../client/cli/commands/info/InfoCommand.java | 2 +- .../cli/commands/install/InstallCommand.java | 2 +- .../cli/commands/logger/LoggerCommand.java | 2 +- .../cli/commands/policy/PolicyCommand.java | 2 +- .../cli/commands/question/QuestionCommand.java | 2 +- .../client/cli/commands/realm/RealmCommand.java | 20 +-- .../cli/commands/report/ReportCommand.java | 2 +- .../cli/commands/resource/ResourceCommand.java | 2 +- .../client/cli/commands/role/RoleCommand.java | 2 +- .../cli/commands/schema/SchemaCommand.java | 2 +- .../cli/commands/self/WorkflowCommand.java | 2 +- .../client/cli/commands/task/TaskCommand.java | 2 +- .../client/cli/commands/user/UserCommand.java | 2 +- 29 files changed, 702 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java index 63d7952..7b417ea 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java @@ -65,7 +65,7 @@ public class Input { public String[] getParameters() { return parameters; } - + public List<String> listParameters() { return Arrays.asList(parameters); } @@ -73,11 +73,15 @@ public class Input { public String firstParameter() { return parameters[0]; } - + public String secondParameter() { return parameters[1]; } + public String thirdParameter() { + return parameters[2]; + } + public String lastParameter() { return parameters[parameters.length - 1]; } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 26873a1..e0f7986 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 @@ -57,7 +57,7 @@ public abstract class CommonsResultManager { Messages.printCommandOptionMessage(message); } - public void defaultError(final String option, final String helpMessage) { + public void defaultOptionMessage(final String option, final String helpMessage) { Messages.printDefaultMessage(option, helpMessage); } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java index 43a5b74..4ab4a38 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java @@ -66,7 +66,7 @@ public class ConfigurationCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new ConfigurationResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new ConfigurationResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); break; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 783c4ec..22892a9 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 @@ -73,7 +73,7 @@ public class ConnectorCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new ConnectorResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new ConnectorResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java index aef9754..d380bd4 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java @@ -67,7 +67,7 @@ public class EntitlementCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new EntitlementResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new EntitlementResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java new file mode 100644 index 0000000..b8f53a5 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.cli.commands.group; + +public abstract class AbstractGroupCommand { + + protected final GroupSyncopeOperations groupSyncopeOperations = new GroupSyncopeOperations(); + + protected final GroupResultManager groupResultManager = new GroupResultManager(); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java new file mode 100644 index 0000000..97edbc5 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java @@ -0,0 +1,124 @@ +/* + * 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.group; + +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.client.cli.Command; +import org.apache.syncope.client.cli.Input; +import org.apache.syncope.client.cli.commands.AbstractCommand; + +@Command(name = "group") +public class GroupCommand extends AbstractCommand { + + private static final String HELP_MESSAGE = "\nUsage: group [options]\n" + + " Options:\n" + + " --help \n" + + " --details \n" + + " --list \n" + + " --read \n" + + " Syntax: --read {GROUP-ID} {GROUP-ID} [...]\n" + + " --read-attr-by-schema-type {GROUP-ID} {SCHEMA-TYPE}\n" + + " Schema type: PLAIN / DERIVED / VIRTUAL\n" + + " --read-attr-by-schema {GROUP-ID} {SCHEMA-TYPE} {SCHEMA-NAME}\n" + + " Schema type: PLAIN / DERIVED / VIRTUAL\n" + + " --delete \n" + + " Syntax: --delete {GROUP-ID} {GROUP-ID} [...]\n"; + + @Override + public void execute(final Input input) { + if (StringUtils.isBlank(input.getOption())) { + input.setOption(GroupOptions.HELP.getOptionName()); + } + switch (GroupOptions.fromName(input.getOption())) { + case DETAILS: + new GroupDetails(input).details(); + break; + case LIST: + new GroupList(input).list(); + break; + case READ: + new GroupRead(input).read(); + break; + case READ_ATTRIBUTES_BY_SCHEMA_TYPE: + new GroupReadAttributesBySchemaType(input).read(); + break; + case READ_ATTRIBUTES_BY_SCHEMA: + new GroupReadAttributeBySchemaTypeAndSchemaName(input).read(); + break; + case DELETE: + new GroupDelete(input).delete(); + break; + case HELP: + System.out.println(HELP_MESSAGE); + break; + default: + new GroupResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); + } + } + + @Override + public String getHelpMessage() { + return HELP_MESSAGE; + } + + private enum GroupOptions { + + HELP("--help"), + DETAILS("--details"), + LIST("--list"), + READ("--read"), + READ_ATTRIBUTES_BY_SCHEMA("--read-attr-by-schema"), + READ_ATTRIBUTES_BY_SCHEMA_TYPE("--read-attr-by-schema-type"), + DELETE("--delete"); + + private final String optionName; + + GroupOptions(final String optionName) { + this.optionName = optionName; + } + + public String getOptionName() { + return optionName; + } + + public boolean equalsOptionName(final String otherName) { + return (otherName == null) ? false : optionName.equals(otherName); + } + + public static GroupOptions fromName(final String name) { + GroupOptions optionToReturn = HELP; + for (final GroupOptions option : GroupOptions.values()) { + if (option.equalsOptionName(name)) { + optionToReturn = option; + } + } + return optionToReturn; + } + + public static List<String> toList() { + final List<String> options = new ArrayList<>(); + for (final GroupOptions value : values()) { + options.add(value.getOptionName()); + } + return options; + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.java new file mode 100644 index 0000000..279f9b2 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.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.group; + +import org.apache.syncope.client.cli.Input; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupDelete extends AbstractGroupCommand { + + private static final Logger LOG = LoggerFactory.getLogger(GroupDelete.class); + + private static final String DELETE_HELP_MESSAGE = "group --delete {GROUP-ID} {GROUP-ID} [...]"; + + private final Input input; + + public GroupDelete(final Input input) { + this.input = input; + } + + public void delete() { + if (input.parameterNumber() >= 1) { + for (final String parameter : input.getParameters()) { + try { + groupSyncopeOperations.delete(parameter); + groupResultManager.deletedMessage("Group", parameter); + } catch (final SyncopeClientException ex) { + LOG.error("Error deleting group", ex); + if (ex.getMessage().startsWith("NotFound")) { + groupResultManager.notFoundError("group", parameter); + } else { + groupResultManager.genericError(ex.getMessage()); + } + } catch (final NumberFormatException ex) { + groupResultManager.numberFormatException("group", parameter); + } + } + } else { + groupResultManager.commandOptionError(DELETE_HELP_MESSAGE); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java new file mode 100644 index 0000000..583c765 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.cli.commands.group; + +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.SyncopeConstants; +import org.apache.syncope.common.lib.to.GroupTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupDetails extends AbstractGroupCommand { + + private static final Logger LOG = LoggerFactory.getLogger(GroupDetails.class); + + private static final String DETAILS_HELP_MESSAGE = "group --details"; + + private final Input input; + + public GroupDetails(final Input input) { + this.input = input; + } + + public void details() { + if (input.parameterNumber() == 0) { + try { + final Map<String, String> details = new LinkedMap<>(); + final List<GroupTO> groupTOs = groupSyncopeOperations.list(); + int withoudResources = 0; + int withoudAttributes = 0; + int onRootRealm = 0; + for (final GroupTO groupTO : groupTOs) { + if (groupTO.getResources() == null || groupTO.getResources().isEmpty()) { + withoudResources++; + } + if ((groupTO.getPlainAttrs() == null || groupTO.getPlainAttrs().isEmpty()) + && (groupTO.getDerAttrs() == null || groupTO.getDerAttrs().isEmpty()) + && (groupTO.getVirAttrs() == null || groupTO.getVirAttrs().isEmpty())) { + withoudAttributes++; + } + if (SyncopeConstants.ROOT_REALM.equals(groupTO.getRealm())) { + onRootRealm++; + } + } + details.put("Total number", String.valueOf(groupTOs.size())); + details.put("Without resources", String.valueOf(withoudResources)); + details.put("Without attributes", String.valueOf(withoudAttributes)); + details.put("On root realm", String.valueOf(onRootRealm)); + details.put("On the other realm", String.valueOf(groupTOs.size() - onRootRealm)); + groupResultManager.printDetails(details); + } catch (final SyncopeClientException ex) { + LOG.error("Error reading details about realm", ex); + groupResultManager.genericError(ex.getMessage()); + } + } else { + groupResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.java new file mode 100644 index 0000000..f5996bb --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.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.group; + +import org.apache.syncope.client.cli.Input; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupList extends AbstractGroupCommand { + + private static final Logger LOG = LoggerFactory.getLogger(GroupList.class); + + private static final String LIST_HELP_MESSAGE = "group --list"; + + private final Input input; + + public GroupList(final Input input) { + this.input = input; + } + + public void list() { + if (input.parameterNumber() == 0) { + try { + groupResultManager.printGroups(groupSyncopeOperations.list()); + } catch (final SyncopeClientException ex) { + LOG.error("Error listing group", ex); + groupResultManager.genericError(ex.getMessage()); + } + } else { + groupResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.java new file mode 100644 index 0000000..6adb8b7 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.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.group; + +import org.apache.syncope.client.cli.Input; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupRead extends AbstractGroupCommand { + + private static final Logger LOG = LoggerFactory.getLogger(GroupRead.class); + + private static final String READ_HELP_MESSAGE = "group --read {GROUP-ID} {GROUP-ID} [...]"; + + private final Input input; + + public GroupRead(final Input input) { + this.input = input; + } + + public void read() { + if (input.parameterNumber() >= 1) { + for (final String parameter : input.getParameters()) { + try { + groupResultManager.printGroup(groupSyncopeOperations.read(parameter)); + } catch (final SyncopeClientException ex) { + LOG.error("Error reading group", ex); + if (ex.getMessage().startsWith("NotFound")) { + groupResultManager.notFoundError("Group", parameter); + } else { + groupResultManager.genericError(ex.getMessage()); + } + } catch (final NumberFormatException ex) { + groupResultManager.numberFormatException("group", parameter); + } + } + } else { + groupResultManager.commandOptionError(READ_HELP_MESSAGE); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaName.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaName.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaName.java new file mode 100644 index 0000000..42432f3 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaName.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.cli.commands.group; + +import org.apache.syncope.client.cli.Input; +import org.apache.syncope.client.cli.util.CommandUtils; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.apache.syncope.common.lib.types.SchemaType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupReadAttributeBySchemaTypeAndSchemaName extends AbstractGroupCommand { + + private static final Logger LOG = LoggerFactory.getLogger(GroupReadAttributeBySchemaTypeAndSchemaName.class); + + private static final String READ_HELP_MESSAGE + = "group --read-attr-by-schema {GROUP-ID} {SCHEMA-TYPE} {SCHEMA-NAME}\n" + + " Schema type: PLAIN / DERIVED / VIRTUAL"; + + private final Input input; + + public GroupReadAttributeBySchemaTypeAndSchemaName(final Input input) { + this.input = input; + } + + public void read() { + if (input.parameterNumber() == 3) { + try { + groupResultManager.printAttribute(groupSyncopeOperations.readAttribute( + input.firstParameter(), input.secondParameter(), input.thirdParameter())); + } catch (final SyncopeClientException ex) { + LOG.error("Error reading group", ex); + groupResultManager.genericError(ex.getMessage()); + } catch (final NumberFormatException ex) { + groupResultManager.numberFormatException("group", input.firstParameter()); + } catch (final IllegalArgumentException ex) { + LOG.error("Error reading schema", ex); + groupResultManager.typeNotValidError( + "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class)); + } + } else { + groupResultManager.commandOptionError(READ_HELP_MESSAGE); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java new file mode 100644 index 0000000..a707a8c --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java @@ -0,0 +1,64 @@ +/* + * 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.group; + +import org.apache.syncope.client.cli.Input; +import org.apache.syncope.client.cli.util.CommandUtils; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.apache.syncope.common.lib.types.SchemaType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GroupReadAttributesBySchemaType extends AbstractGroupCommand { + + private static final Logger LOG = LoggerFactory.getLogger(GroupReadAttributesBySchemaType.class); + + private static final String READ_HELP_MESSAGE = "group --read-attr-by-schema-type {GROUP-ID} {SCHEMA-TYPE}\n" + + " Schema type: PLAIN / DERIVED / VIRTUAL"; + + private final Input input; + + public GroupReadAttributesBySchemaType(final Input input) { + this.input = input; + } + + public void read() { + if (input.parameterNumber() == 2) { + try { + groupResultManager.printAttributes(groupSyncopeOperations.readAttributes( + input.firstParameter(), input.secondParameter())); + } catch (final SyncopeClientException ex) { + LOG.error("Error reading group", ex); + if (ex.getMessage().startsWith("NotFound")) { + groupResultManager.notFoundError("Group", input.firstParameter()); + } else { + groupResultManager.genericError(ex.getMessage()); + } + } catch (final NumberFormatException ex) { + groupResultManager.numberFormatException("group", input.firstParameter()); + } catch (final IllegalArgumentException ex) { + LOG.error("Error reading schema", ex); + groupResultManager.typeNotValidError( + "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class)); + } + } else { + groupResultManager.commandOptionError(READ_HELP_MESSAGE); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java new file mode 100644 index 0000000..d8dda12 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java @@ -0,0 +1,85 @@ +/* + * 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.group; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.apache.syncope.client.cli.commands.CommonsResultManager; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.common.lib.to.GroupTO; + +public class GroupResultManager extends CommonsResultManager { + + public void printGroups(final List<GroupTO> groupTOs) { + System.out.println(""); + for (final GroupTO groupTO : groupTOs) { + printGroup(groupTO); + } + } + + public void printGroup(final GroupTO groupTO) { + System.out.println(" > GROUP ID: " + groupTO.getKey()); + System.out.println(" name: " + groupTO.getName()); + System.out.println(" display name: " + groupTO.getDisplayName()); + System.out.println(" type: " + groupTO.getType()); + System.out.println(" realm: " + groupTO.getRealm()); + System.out.println(" status: " + groupTO.getStatus()); + System.out.println(" user owner: " + groupTO.getUserOwner()); + System.out.println(" group owner: " + groupTO.getGroupOwner()); + System.out.println(" RESOURCES: "); + printResources(groupTO.getResources()); + System.out.println(" PLAIN ATTRIBUTES: "); + printAttributes(groupTO.getPlainAttrs()); + System.out.println(" DERIVED ATTRIBUTES: "); + printAttributes(groupTO.getDerAttrs()); + System.out.println(" VIRTUAL ATTRIBUTES: "); + printAttributes(groupTO.getVirAttrs()); + System.out.println(""); + } + + private void printResources(final Set<String> resources) { + for (final String resource : resources) { + System.out.println(" - " + resource); + } + } + + public void printAttributes(final Set<AttrTO> attributes) { + for (final AttrTO attribute : attributes) { + printAttribute(attribute); + } + } + + public void printAttribute(final AttrTO attribute) { + final StringBuilder attributeMessageBuilder = new StringBuilder(); + attributeMessageBuilder.append(" ") + .append(attribute.getSchema()) + .append(": ") + .append(attribute.getValues()); + if (attribute.isReadonly()) { + attributeMessageBuilder.append(" - is readonly"); + } + System.out.println(attributeMessageBuilder.toString()); + System.out.println(""); + } + + public void printDetails(final Map<String, String> details) { + printDetails("groups details", details); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java new file mode 100644 index 0000000..744fbe8 --- /dev/null +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java @@ -0,0 +1,63 @@ +/* + * 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.group; + +import java.util.List; +import java.util.Set; +import org.apache.syncope.client.cli.SyncopeServices; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.types.SchemaType; +import org.apache.syncope.common.rest.api.beans.AnyListQuery; +import org.apache.syncope.common.rest.api.service.GroupService; + +public class GroupSyncopeOperations { + + private final GroupService groupService = SyncopeServices.get(GroupService.class); + + public List<GroupTO> list() { + return groupService.list(new AnyListQuery()).getResult(); + } + + public GroupTO read(final String groupId) { + return groupService.read(Long.valueOf(groupId)); + } + + public Set<AttrTO> readAttributes(final String groupId, final String schemaType) { + return groupService.read(Long.valueOf(groupId), SchemaType.valueOf(schemaType)); + } + + public AttrTO readAttribute(final String groupId, final String schemaType, final String schema) { + return groupService.read(Long.valueOf(groupId), SchemaType.valueOf(schemaType), schema); + } + + public void delete(final String groupId) { + groupService.delete(Long.valueOf(groupId)); + } + + public boolean exists(final String realm) { + boolean exists = false; + for (final GroupTO list : list()) { + if (list.getName().equals(realm)) { + exists = true; + } + } + return exists; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java index eed0924..a42ff85 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java @@ -40,7 +40,7 @@ public class HelpCommand extends AbstractCommand { new Help().help(); break; default: - new HelpResultManager().defaultError( + new HelpResultManager().defaultOptionMessage( input.getOption(), CommandUtils.helpMessage("info", Options.toList())); break; } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java index 31b9aaa..a5c7cd8 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java @@ -108,7 +108,7 @@ public class InfoCommand extends AbstractCommand { System.out.println(CommandUtils.helpMessage("info", Options.toList())); break; default: - new InfoResultManager().defaultError( + new InfoResultManager().defaultOptionMessage( input.getOption(), CommandUtils.helpMessage("info", Options.toList())); break; } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java index 7c12f3b..b71eddd 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java @@ -58,7 +58,7 @@ public class InstallCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - installResultManager.defaultError(input.getOption(), HELP_MESSAGE); + installResultManager.defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 1c13368..482c14e 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 @@ -76,7 +76,7 @@ public class LoggerCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new LoggerResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new LoggerResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 1bd63b7..6c11f02 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 @@ -63,7 +63,7 @@ public class PolicyCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new PolicyResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new PolicyResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java index 305cc13..9ed995b 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java @@ -56,7 +56,7 @@ public class QuestionCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new QuestionResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new QuestionResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 b751c29..1fcf380 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 @@ -28,7 +28,7 @@ import org.apache.syncope.client.cli.commands.AbstractCommand; @Command(name = "realm") public class RealmCommand extends AbstractCommand { - private static final String HELP_MESSAGE = "1nUsage: realm [options]\n" + private static final String HELP_MESSAGE = "\nUsage: realm [options]\n" + " Options:\n" + " --help \n" + " --details \n" @@ -37,9 +37,9 @@ public class RealmCommand extends AbstractCommand { @Override public void execute(final Input input) { if (StringUtils.isBlank(input.getOption())) { - input.setOption(Options.HELP.getOptionName()); + input.setOption(RealmOptions.HELP.getOptionName()); } - switch (Options.fromName(input.getOption())) { + switch (RealmOptions.fromName(input.getOption())) { case DETAILS: new RealmDetails(input).details(); break; @@ -50,7 +50,7 @@ public class RealmCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new RealmResultManager().deletedMessage(input.getOption(), HELP_MESSAGE); + new RealmResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } @@ -59,7 +59,7 @@ public class RealmCommand extends AbstractCommand { return HELP_MESSAGE; } - private enum Options { + private enum RealmOptions { HELP("--help"), DETAILS("--details"), @@ -67,7 +67,7 @@ public class RealmCommand extends AbstractCommand { private final String optionName; - Options(final String optionName) { + RealmOptions(final String optionName) { this.optionName = optionName; } @@ -79,9 +79,9 @@ public class RealmCommand extends AbstractCommand { return (otherName == null) ? false : optionName.equals(otherName); } - public static Options fromName(final String name) { - Options optionToReturn = HELP; - for (final Options option : Options.values()) { + public static RealmOptions fromName(final String name) { + RealmOptions optionToReturn = HELP; + for (final RealmOptions option : RealmOptions.values()) { if (option.equalsOptionName(name)) { optionToReturn = option; } @@ -91,7 +91,7 @@ public class RealmCommand extends AbstractCommand { public static List<String> toList() { final List<String> options = new ArrayList<>(); - for (final Options value : values()) { + for (final RealmOptions value : values()) { options.add(value.getOptionName()); } return options; http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 0e5ffd8..560cf25 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 @@ -86,7 +86,7 @@ public class ReportCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new ReportResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new ReportResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 7614680..4c137c0 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 @@ -61,7 +61,7 @@ public class ResourceCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new ResourceResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new ResourceResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 b514b84..9d73020 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 @@ -61,7 +61,7 @@ public class RoleCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new RoleResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new RoleResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 84df578..8e7f146 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 @@ -76,7 +76,7 @@ public class SchemaCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new SchemaResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new SchemaResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java index 3f378cf..96643ea 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/self/WorkflowCommand.java @@ -53,7 +53,7 @@ public class WorkflowCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new WorkflowResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new WorkflowResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 d2199d3..bf76ff0 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 @@ -87,7 +87,7 @@ public class TaskCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new TaskResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new TaskResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/26a4cd26/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 66aebd9..d219f24 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 @@ -86,7 +86,7 @@ public class UserCommand extends AbstractCommand { System.out.println(HELP_MESSAGE); break; default: - new UserResultManager().defaultError(input.getOption(), HELP_MESSAGE); + new UserResultManager().defaultOptionMessage(input.getOption(), HELP_MESSAGE); } }
